context property
BuildContext?
get
context
Most recent BuildContext/Element
Implementation
BuildContext? get context {
BuildContext? context;
while (_states.isNotEmpty) {
try {
context = _states.last.values.last.context;
break;
} catch (ex) {
if (ex is FlutterError && ex.message.contains('unmounted')) {
_states.remove(_states.last);
} else {
break;
}
}
}
return context;
}