get method

  1. @override
Future<String?> get(
  1. CalljmpStoreKey key
)
override

Retrieves a value from secure storage with caching.

This method first checks the in-memory cache for the requested key. If not found in cache, it calls the native platform implementation and caches the result for future use.

key The storage key to retrieve the value for.

Returns a Future that resolves to the stored value, or null if not found.

Example

final token = await store.get(CalljmpStoreKey.accessToken);
if (token != null) {
  print('Access token found: ${token.substring(0, 10)}...');
}

Implementation

@override
Future<String?> get(CalljmpStoreKey key) async {
  if (_cache.containsKey(key)) {
    return _cache[key];
  }
  final value = await methodChannel.invokeMethod<String>("secureGet", {
    "key": key.name,
  });
  _cache[key] = value;
  return value;
}