value property

  1. @override
List<T> get value
override

Gets the value of the JSON list field.

Returns:

  • The list of T objects.

Implementation

@override
List<T> get value => rawValue ?? [];
  1. @override
set value (dynamic value)
override

Sets the value of the JSON list field.

Parameters:

  • value: The new value of the field.

Implementation

@override
set value(dynamic value) {
  if (value == null) {
    rawValue = [];
    return;
  }
  if (value is List<T>) {
    rawValue = value;
    return;
  }
  if (value is List) {
    rawValue = value.map((element) {
      final model = GetIt.instance.get<T>();
      model.fromJSON(element);
      return model;
    }).toList();
  }
}