是否有Dart包的命名约定?是否有可能描述模式的文档?我无法确定包含多个单词的包名称的命名约定.举例来说,我应该使用placeView
,PlaceView
,place_view
,还是别的什么?
似乎没有一个约定,但大多数时候,我看到它lowercase_words_with_underscore
被用于库和包。
对于包内的库,有些人还使用点进行分组,例如my_package.lib_1
和my_package.lib_2
。
我想这都是个人喜好。
只能使用小写字母创建flutter项目,项目名称之间不能有空格,避免添加特殊字符。按照以下步骤操作,您将不会收到此类错误。
"ProjectName" is not a valid Dart package name.
From the [Pubspec format description](https://www.dartlang.org/tools/pub/pubspec.html):
**DO** use `lowercase_with_underscores` for package names.
Package names should be all lowercase, with underscores to separate words,
`just_like_this`. Use only basic Latin letters and Arabic digits: [a-z0-9_].
Also, make sure the name is a valid Dart identifier -- that it doesn't start
with digits and isn't a reserved word.
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
3148 次 |
最近记录: |