initializedWithError method
The method that marks the object was initialized with an error.
Implementation
@protected
void initializedWithError({
Object? error,
String? message,
StackTrace? stackTrace,
}) {
assert(
error != null && message == null || error == null && message != null,
'You must provide either an error or a message',
);
if (_completer.isCompleted) {
throw EnsureInitializedException('Object was already initialized');
}
if (error == null) {
_completer.completeError(
EnsureInitializedException(message!),
stackTrace,
);
} else {
_completer.completeError(
error,
stackTrace,
);
}
}