completeError method

void completeError(
  1. Object error, [
  2. StackTrace? stackTrace
])

Completes operation with error and stackTrace.

This method may not be called after either complete or completeError has been called once. The isCompleted is true when either of these methods have been called.

Implementation

void completeError(Object error, [StackTrace? stackTrace]) {
  if (!_mayComplete) throw StateError('Operation already completed');
  _mayComplete = false;
  _completeNow()?.completeError(error, stackTrace);
}