fromJson<T> method

  1. @override
T fromJson<T>(
  1. dynamic json
)

fromJson remains with same properties as default serializer.

Implementation

@override

/// fromJson remains with same properties as default serializer.
T fromJson<T>(dynamic json) {
  if (T == DateTime) {
    return DateTime.parse(json as String) as T;
  } else if (T == double && json is int) {
    return json.toDouble() as T;
  } else if (T == Uint8List && json is! Uint8List) {
    final asList = (json as List).cast<int>();
    return Uint8List.fromList(asList) as T;
  }
  return json as T;
}