stateByType<T extends StateX<StatefulWidget>> method

T? stateByType<T extends StateX<StatefulWidget>>()
inherited

Retrieve the State object by type Returns null if not found

Implementation

T? stateByType<T extends StateX>() {
  StateX? state;
  try {
    for (final item in _MapOfStates._states.values) {
      if (item is T) {
        state = item;
        break;
      }
    }
  } catch (_) {
    state = null;
  }
  return state == null ? null : state as T;
}