get method

Future<T?> get()

Retrieves the current copy of this data, if it exists, or fetches it.

Implementation

Future<T?> get() {
  if (_currentValue != null) {
    return Future.value(_currentValue);
  } else {
    try {
      if (isReady.isStarted) {
        return isReady.future;
      } else {
        return loadInitial().timeout(Duration(seconds: 10));
      }
    } on TimeoutException catch (e, stack) {
      log.severe("Timeout fetching $T in ${this.runtimeType}", e, stack);
      rethrow;
    }
  }
}