beforeValueChange property

(Future Function(dynamic value)?) beforeValueChange
final

It is a callback function which accepts component's future value as a parameter and returns a Future.

It is called every-time before a component's value changes. The promise, if and when resolved, triggers the execution of the component's query and if rejected, kills the query execution. This method can act as a gatekeeper for query execution, since it only executes the query after the provided promise has been resolved.

For example:

Future (value) {
  // called before the value is set
  // returns a [Future]
  // update state or component props
  return Future.value(value);
  // or Future.error()
}

Implementation

final Future Function(dynamic value)? beforeValueChange;