decodeObjectOrNull<T> method

  1. @override
T? decodeObjectOrNull<T>(
  1. String key, {
  2. int? id,
  3. Decodable<T>? using,
})
override

Decodes the data for the given key or id as a nullable object of type T.

When the data is not null, this behaves like decodeObject.

Implementation

@override
T? decodeObjectOrNull<T>(String key, {int? id, Decodable<T>? using}) {
  final v = _value[key];
  if (v == null) return null;
  try {
    return _decode(v, using);
  } catch (e, st) {
    Error.throwWithStackTrace(CodableException.wrap(e, method: 'decode', hint: '["$key"]'), st);
  }
}