sealed top-level constant

Object const sealed

Annotation on class that must not be subclassed outside of its package.

Classes in the same package as the marked class may extend, implement or mix-in the annotated class as normal.

Tools, such as the analyzer, can provide feedback if

  • the annotation is associated with anything other than a class,
  • the annotation is associated with a class C, and there is a class or mixin D, which extends, implements, mixes in, or constrains to C, and C and D are declared in different packages.

Note: In Dart 3 and later, you can use built-in class modifiers to control what forms of subtyping are allowed outside the current library. To learn more about using class modifiers, check out the Class modifiers documentation.

Implementation

const Object sealed = _Sealed();