- In Dart, if the leading character is an underscore, then the function/constructor is private to the library.
Class._();
is a named constructor (another example might be the copy constructor on some object in Flutter:AnotherClass.copy(...);
).- The
Class._();
isn’t necessary unless you don’t wantClass
to ever be accidentally instantiated using the implicit default constructor.