decodeObject<T extends Coding> method

T? decodeObject<T extends Coding>(
  1. String? key,
  2. T inflate()
)

Returns the instance of T associated with key.

inflate must create an empty instance of T. The value associated with key must be a KeyedArchive (a Map). The values of the associated object are read into the empty instance of T.

Implementation

T? decodeObject<T extends Coding>(String? key, T inflate()) {
  final val = _getValue(key);
  if (val == null) {
    return null;
  }

  if (val is! KeyedArchive) {
    throw new ArgumentError(
        "Cannot decode key '$key' into '$T', because the value is not a Map. Actual value: '$val'.");
  }

  return _decodedObject(val, inflate);
}