getObject method

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

Retrieves and decodes a JSON object stored under key.

Returns null if the key does not exist.

Implementation

Map<String, dynamic>? getObject(String key) {
  try {
    final raw = _store.getString(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,
    );
  }
}