Dart中使用的包命名约定是什么? [英] What is package naming convention used in Dart?

查看:183
本文介绍了Dart中使用的包命名约定是什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Dart包是否有命名约定?可能有描述模式的文档吗?我很难弄清楚包含多个单词的软件包名称的命名约定。例如,我应该使用 placeView PlaceView place_view ,还是其他?

Is there a naming convention for Dart packages? Is there maybe a document that describes patterns? I have trouble figuring out naming convention for package names that consist of multiple words. For example, should I use placeView, PlaceView, place_view, or something else?

推荐答案

Pubspec格式文档的doc / pubspec.html#name rel = noreferrer>名称节

This is documented on the name section of Pubspec Format documentation.


应全部为小写,并带有下划线以分隔单词, just_like_this 。坚持使用基本的拉丁字母和阿拉伯数字: [a-z0-9 _] 并确保它是有效的Dart标识符(即,不是以数字开头并且不是

It should be all lowercase, with underscores to separate words, just_like_this. Stick with basic Latin letters and Arabic digits: [a-z0-9_] and ensure that it’s a valid Dart identifier (i.e. doesn’t start with digits and isn’t a reserved word).

尝试选择一个清晰,简洁且尚未使用的名称。

Try to pick a name that is clear, terse, and not already in use.

这篇关于Dart中使用的包命名约定是什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆