clearPersistentStorage static method

Future<void> clearPersistentStorage(
  1. StorageManager storage
)

Clears public, encrypted, and keychain values through one lifecycle primitive shared by snapshot restore and explicit storage reset.

Implementation

static Future<void> clearPersistentStorage(StorageManager storage) async {
  await storage.clearPublicStorage();
  for (final key
      in storage.getKeys().where((key) => key.startsWith('enc_')).toList()) {
    await storage.remove(key);
  }
  final keychain = await storage.getAllFromKeychain();
  for (final key in keychain.keys) {
    await storage.removeSecurely(key);
  }
}