deserialize<T> static method

T? deserialize<T>(
  1. dynamic jsonValue, [
  2. DeserializationOptions? options
])

Converts JSON String Or Object Or Map<String, dynamic> to Dart object instance of type T jsonValue could be as of String type, then it will be parsed internally jsonValue could be as of Object type, then it will be processed as is jsonValue could be as of Map<String, dynamic> type, then it will be processed as is

Implementation

static T? deserialize<T>(dynamic jsonValue,
    [DeserializationOptions? options]) {
  final targetOptions = options ?? JsonMapper.globalDeserializationOptions;
  final targetType = T != dynamic
      ? T
      : targetOptions.template != null
          ? targetOptions.template.runtimeType
          : targetOptions.type ?? dynamic;
  assert(targetType != dynamic
      ? true
      : throw MissingTypeForDeserializationError());
  return instance._deserializeObject(
      jsonValue != null
          ? jsonValue is String
              ? _jsonDecoder.convert(jsonValue)
              : jsonValue
          : null,
      DeserializationContext(targetOptions,
          classMeta:
              instance._classes[targetType]?.getMeta(targetOptions.scheme),
          typeInfo: instance._getTypeInfo(targetType))) as T?;
}