cancel method

  1. @override
void cancel({
  1. bool always = false,
})
override

Cancels the current data loading operation, if any.

If (and only if) the current state is Loading (i.e. isLoading), the refresh operation is cancelled by setting the value to Error.cancelled. If specified, the onReset function will also be invoked.

If always is true, cancellation will happen regardless of the current state.

Implementation

@override
void cancel({bool always = false}) {
  final subscription = _subscription;
  _subscription = null;
  subscription?.cancel();
  super.cancel(always: (subscription != null) || always);
}