Creating a Non-Instantiable, Non-Extendable Class
问题 I want to make a class to group some static const values. // SomeClass.dart class SomeClass { static const SOME_CONST = 'some value'; } What is the idiomatic way in dart to prevent dependent code from instantiating this class? I would also like to prevent extension to this class. In Java I would do the following: // SomeClass.java public final class SomeClass { private SomeClass () {} public static final String SOME_CONST = 'some value'; } So far all I can think of is throwing an Exception ,