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 == null) {
    current = null;
    return true;
  }
  if (json is T) {
    current = json;
    return true;
  }
  final child = childCreator();
  final result = child.setFromJson(json);
  if (result) {
    current = child;
  }
  return result;
}