context property Null safety

BuildContext? context

Get an active BuildContext.

The obtained BuildContext is one of the states_rebuilder's widgets context;

For this reason you have to use at least one of states_rebuilder's widgets.


static BuildContext? get context {
  if (_context != null) {
    return _context;

  if (_contextSet.isNotEmpty) {
    if (_contextSet.last.findRenderObject()?.attached != true) {
      // ignore: recursive_getters
      return context;
    return _contextSet.last;

  return RM.navigate._navigatorKey.currentState?.context;