context property Null safety
Provides safe access to the build context.
If dispose has been called, will return null.
Otherwise, asserts the _state
is still mounted and returns its context.
Implementation
BuildContext? get context {
assert(_debugValidate());
if (_state == null) {
return null;
}
return _state!.context;
}