decode method

  1. @override
T? decode(
  1. String? jsonString
)
override

Decodes a value of storage type TStore back to type T.

Returns null if the stored value is null or cannot be decoded.

Implementation

@override
T? decode(String? jsonString) {
  if (jsonString == null) return null;
  try {
    final map = jsonDecode(jsonString);
    if (map is Map<String, dynamic>) {
      return fromJson(map);
    }
    return null;
  } catch (_) {
    return null;
  }
}