clear method

Future<void> clear()

Implementation

Future<void> clear() async {
  // Ensure _prefs has been initialized before using it
  _prefs ??= await SharedPreferences.getInstance();

  var keys = _prefs!.getKeys();
  for (String key in keys) {
    if (key.startsWith(_keyPrefix)) {
      await _prefs!.remove(key);
    }
  }
}