initialize method
Initializes something.
Will throw if before was called ensureInitialized:
- There is already initialization in progress.
- This object is already initialized.
For protected use only, and only for ensureInitialized.
BTW, u are free to use it as u want.
Implementation
@protected
@mustCallSuper
@visibleForTesting
FutureOr<void> initialize() {
assert((){
if (_isInitializingAssertionDisabled) {
_isInitializingAssertionDisabled = false;
return true;
}
return _state != _initializingState;
}(),
'There is already initialization in progress',
);
assert(
_state != _initializedState,
'$_className has been initialized already. '
'Use $_className.ensureInitialized to initialize it safely.');
}