getLoadedData<T> method

T getLoadedData<T>()

Get the loaded data from a DataScope.

If the data hasn't been loaded, then StateError will be thrown.

Implementation

T getLoadedData<T>() {
  final state = DataScope.of<T>(this);
  if (state.dataLoaded) {
    return state.data;
  }
  throw StateError('The data has not yet been loaded.');
}