What is package naming convention used in Dart? What is package naming convention used in Dart? dart dart

What is package naming convention used in Dart?


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

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.


There doesn't seem to be a convention for it, but most of the time, I see lowercase_words_with_underscore being used, both for libraries and packages.

For libraries inside packages, some people also use dots for grouping, for example my_package.lib_1 and my_package.lib_2.

It's all personal preference, I guess.


All the package conventions are documented on pub.dartlang.org. The package naming conventions in particular are documented on the pubspec format page.