getObject method

Future<Map<String, dynamic>?> getObject(
  1. String key
)

Reads, decrypts, and decodes a JSON object stored under key.

Returns null if the key does not exist or the value cannot be parsed.

Implementation

Future<Map<String, dynamic>?> getObject(String key) async {
  try {
    final raw = await _storage.read(key: key);
    if (raw == null) return null;
    return jsonDecode(raw) as Map<String, dynamic>;
  } catch (e, st) {
    throw StorageException(
      message: 'Failed to get Object',
      key: key,
      cause: e,
      stackTrace: st,
    );
  }
}