load method

Future<TokenPair?> load()

Loads tokens from memory or storage.

The first call reads from TokenStore.read and caches the result. Later calls reuse the cached value.

Implementation

Future<TokenPair?> load() {
  if (_cached != null) return Future.value(_cached);

  _loadFuture ??= _store.read().then((t) {
    _cached = t;
    return t;
  });

  return _loadFuture!;
}