existsOnPrefs method

Future<bool> existsOnPrefs()

Checks if the key exists in SharedPreferences.

Returns true if the key exists, even if its value is null.

Example:

final username = PrfString('username');
if (await username.existsOnPrefs()) {
  // The key exists in storage
}

Implementation

Future<bool> existsOnPrefs() async {
  final prefs = await Prf.getInstance();
  return prefs.containsKey(key);
}