unbox<T> method

T unbox<T>()

Implementation

T unbox<T>() {
  if (T == FluentJson) {
    return this as T;
  }
  if (null is! T && json == null) {
    throw Exception(
      '''Expected json to be a non nullable value but found null.
${_describeForException()}''',
    );
  }
  if (json is! T) {
    throw Exception(
      '''Expected json to be type $T but found ${json.runtimeType}.
${_describeForException()}''',
    );
  }
  return json as T;
}