decodeNumOrNull method

  1. @override
num? decodeNumOrNull(
  1. String key, {
  2. int? id,
})
override

Decodes the data for the given key or id as a nullable num value.

Implementation

@override
num? decodeNumOrNull(String key, {int? id}) {
  try {
    return _value[key] as num?;
  } on TypeError {
    throw CodableException.wrap(
      CodableException.unexpectedType(expected: 'num?', actual: '${_value[key].runtimeType}', data: _value[key]),
      method: 'decode',
      hint: '["$key"]',
    );
  }
}