destroy method

Future<void> destroy({
  1. Context? ctx,
  2. bool localOnly = false,
})

Implementation

Future<void> destroy({Context? ctx, bool localOnly = false}) async {
  await ready();
  final token = this.token;
  if (!localOnly && token.isNotEmpty) {
    try {
      await _tokenizer.destroy(token, ctx: _withToken(ctx, token));
    } catch (_) {
      // Ignore remote destroy failures and clear local state anyway.
    }
  }
  await _clearCache();
  _setState(
    _state.copyWith(
      ready: true,
      session: null,
      expiresAt: null,
      authenticating: false,
    ),
  );
}