required top-level constant

Required const required

Used to annotate a named parameter p in a method or function f. Indicates that every invocation of f must include an argument corresponding to p, despite the fact that p would otherwise be an optional parameter.

Tools, such as the analyzer, can provide feedback if

  • the annotation is associated with anything other than a named parameter,
  • the annotation is associated with a named parameter in a method m1 that overrides a method m0 and m0 defines a named parameter with the same name that does not have this annotation, or
  • an invocation of a method or function does not include an argument corresponding to a named parameter that has this annotation.

Deprecated: This annotation is set to be deprecated and later removed in a future release of package:meta. In Dart 2.12 and later, use the built-in required keyword to mark a named parameter as required. To learn more about required, check out the documentation on named parameters.

Implementation

const Required required = Required();