useResult top-level constant Null safety

UseResult const useResult

Used to annotate a method, field, or getter within a class, mixin, or extension, or a or top-level getter, variable or function to indicate that the value obtained by invoking it should be used. A value is considered used if it is assigned to a variable, passed to a function, or used as the target of an invocation, or invoked (if the result is itself a function).

Tools, such as the analyzer, can provide feedback if

  • the annotation is associated with anything other than a method, field or getter, top-level variable, getter or function or
  • the value obtained by a method, field, getter or top-level getter, variable or function annotated with @useResult is not used.

Implementation

const UseResult useResult = UseResult();