cancel method
Cancel the underlying StreamSubscription.
Returns true
if the StreamSubscription was successfully cancelled,
or if it was already cancelled.
Returns true
if isDone and cancelOnDone are true
.
Returns true
if hadError and cancelOnError are true
.
Implementation
Future<bool> cancel() async {
if (isCancelled.value) return true;
if (isDone.value) return cancelOnDone;
if (hadError) return cancelOnError;
_isCancelledNotifier.value = true;
await _sub!.cancel();
_sub = null;
return true;
}