Is prefacing a class name with underscore the correct way to ensure a class is not usable outside a library? Is prefacing a class name with underscore the correct way to ensure a class is not usable outside a library? dart dart

Is prefacing a class name with underscore the correct way to ensure a class is not usable outside a library?


Yes, the underscore works for class names the same as functions, methods, and fields, it makes them library-private.


Yes. this is correct way and there is no better way to do this in Google Dart language.
It is also the only possible way to use the privacy (does not provided other levels of privacy).