orCancel property
Future<void>
get
orCancel
A future that completes normally on natural animation end, and rejects with TickerCanceled on cancel. Accessing this is the opt-in path to seeing cancellations as errors.
Implementation
Future<void> get orCancel {
final existing = _secondary;
if (existing != null) return existing.future;
final s = Completer<void>();
_secondary = s;
// If completion already happened before orCancel was accessed,
// resolve synchronously now.
final state = _completed;
if (state == true) {
s.complete();
} else if (state == false) {
s.completeError(const TickerCanceled());
}
return s.future;
}