setFromJson method

  1. @override
bool setFromJson(
  1. dynamic json
)
override

Convert any given json to correspondig types and store it. If fails, it returns false.

Implementation

@override
bool setFromJson(json) {
  if (json is Iterable) {
    _list.clear();
    for (final value in json) {
      if (value is T) {
        _list.add(value);
      } else if (value is JsonType) {
        _list.add(childCreator()..setFromJson(value.toJson()));
      } else {
        _list.add(childCreator()..setFromJson(value));
      }
    }
    return true;
  }
  return false;
}