What is package naming convention used in Dart?

markovuksanovic picture markovuksanovic · Jan 28, 2014 · Viewed 19.8k times · Source

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?

Answer

Alexandre Ardhuin picture Alexandre Ardhuin · Jan 28, 2014

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.