preAuthIfNeeded method

Future<void> preAuthIfNeeded()

Awaits any in-flight recovery; if _needsRecovery is set and no recovery is in-flight, starts one and awaits it. Concurrent callers coalesce onto the same future so a single recovery runs per wallet.

Implementation

Future<void> preAuthIfNeeded() async {
  if (!_needsRecovery) {
    return;
  }
  final Future<void> inFlight = _recovering ??= recover();
  try {
    await inFlight;
  } finally {
    if (identical(_recovering, inFlight)) {
      _recovering = null;
    }
  }
}