useResult top-level constant

UseResult const useResult

Annotation on function or property whose value must not be ignored.

Used to annotate a method, field, or getter within a class, mixin, or extension, or a 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 not silently discarded. This includes being assigned to a variable, passed as an argument, returned, placed in a collection or record, used in a pattern, used in a control flow condition or assert, 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();