fromJSON method

  1. @override
void fromJSON(
  1. dynamic value
)
override

Implementation

@override
void fromJSON(dynamic value) {
  if (value is List) {
    final ModelType typeMapping = DataModel.getType(genericType);
    this.value = value.map((element) {
      final T instance = typeMapping.constructor() as T;
      instance.fromJSON(element);
      return instance;
    }).toList();
  }
}