diff --git a/lib/util/shared_preferences.dart b/lib/util/shared_preferences.dart index 5082009a..c7915b1c 100644 --- a/lib/util/shared_preferences.dart +++ b/lib/util/shared_preferences.dart @@ -101,7 +101,14 @@ class XSharedPreferences { // Proxy methods for [EncryptedSharedPreferences] - Future clear() => _preferences.clear(); + Future clear() async { + bool success = await _preferences.clear(); + if (success) { + // mark the data as migrated after clearing. Or the data written after clearing will be re-migrated. + await _instance!.setBool(KEY_MIGRATED, true); + } + return success; + } Future remove(String key) => _preferences.remove(key);