getOrFetch method

Future<T> getOrFetch(
  1. Future<T> provider()
)

Gets or computes the value using the provided provider function.

Note: This cannot be called if a provider was set using the constructor. Attempting to call this method in that case will result in an exception.

Implementation

Future<T> getOrFetch(Future<T> Function() provider) async {
  if (this.provider != null) {
    throw ArgumentError(
        'Cannot call getOrFetch when provider is set in the constructor');
  }
  return _getUsingProvider(provider);
}