has method

  1. @override
Future<bool> has(
  1. String key
)
override

Checks if a key exists in secure storage.

Returns true if the key exists in storage, false otherwise. This is useful for checking if a value exists before attempting to read it.

Example:

if (await storage.has('auth.token')) {
  final token = await storage.read('auth.token');
  // Use token...
} else {
  // Handle missing token...
}

See also:

  • read - Read a stored value
  • delete - Delete a stored value

Implementation

@override
Future<bool> has(String key) async {
  final containsKey = await _storage.containsKey(key: key);
  return containsKey;
}