refresh method

Future<T?> refresh()
inherited

Refresh the Injected state. Refreshing the state means reinitialize it and reinvoke its creation function and notify its listeners.

If the state is persisted using PersistState, the state is deleted from the store and the new recalculated state is stored instead.

If the Injected model has Injected.inherited injected models, they will be refreshed also.

Implementation

Future<T?> refresh() async {
  _reactiveModelState._refresh();
  try {
    return await stateAsync;
  } catch (_) {
    try {
      return _state;
    } catch (_) {
      return null;
    }
  }
}