factory top-level constant Null safety

_Factory const factory

Used to annotate an instance or static method m. Indicates that m must either be abstract or must return a newly allocated object or null. In addition, every method that either implements or overrides m is implicitly annotated with this same annotation.

Tools, such as the analyzer, can provide feedback if

  • the annotation is associated with anything other than a method, or
  • a method that has this annotation can return anything other than a newly allocated object or null.

Implementation

const _Factory factory = _Factory();