factory top-level constant

Object const factory

Annotation on a function that creates new objects.

Used to annotate an instance or static method.

Indicates that the method must either be abstract (for an instance method) or must return either a newly allocated object or null. In addition, every instance method that implements or overrides the method 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 Object factory = _Factory();