checkInitialized static method
Check whether this has been initialized.
Throws StateError if not.
Wrap in assert to exclude this method from code.
Returns true for use within assert statement.
Implementation
@protected
static bool checkInitialized(Initializer initializer, [String? methodName]) {
if (initializer._state != _initializedState) {
final beforeUsingMethod =
methodName == null ? '' : ' before using $methodName';
throw StateError(
'${initializer._className} has not been initialized$beforeUsingMethod '
'Use ${initializer._className}.ensureInitialized.');
}
return true;
}