getOrFallback method

Future<T> getOrFallback(
  1. T fallback
)

Gets the value or returns the provided fallback if the value is null.

This is a convenience method that combines get with a null check.

Implementation

Future<T> getOrFallback(T fallback) async {
  return (await get()) ?? fallback;
}