Skip to main content

Dart Private

Dart does not have a private keyword like Java. It uses the underscore _ to denote private class and methods.

https://dart.dev/language#important-concepts

Unlike Java, Dart doesn’t have the keywords public, protected, and private. If an identifier starts with an underscore (_), it’s private to its library. For details, see Libraries and imports.

https://dart.dev/language/libraries

Libraries not only provide APIs, but are a unit of privacy: identifiers that start with an underscore (_) are visible only inside the library. Every Dart file (plus its parts) is a library, even if it doesn’t use a library directive