capture static method

Implementation

static Future<AppSessionSnapshot> capture() async {
  final storage = StorageManager();
  final publicStorage = <String, dynamic>{};
  for (final key in storage.getKeys()) {
    publicStorage[key] = _copy(storage.read(key));
  }
  final keychain = await storage.getAllFromKeychain();
  return AppSessionSnapshot(
    publicStorage: publicStorage,
    keychain: {
      for (final entry in keychain.entries) entry.key: _copy(entry.value),
    },
    locale: Ensemble().getLocale(),
  );
}