FlutterWidgetPropertyValue.fromJson constructor

FlutterWidgetPropertyValue.fromJson(
  1. JsonDecoder jsonDecoder,
  2. String jsonPath,
  3. Object? json
)

Implementation

factory FlutterWidgetPropertyValue.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    bool? boolValue;
    if (json.containsKey('boolValue')) {
      boolValue =
          jsonDecoder.decodeBool('$jsonPath.boolValue', json['boolValue']);
    }
    double? doubleValue;
    if (json.containsKey('doubleValue')) {
      doubleValue = jsonDecoder.decodeDouble(
          '$jsonPath.doubleValue', json['doubleValue'] as Object);
    }
    int? intValue;
    if (json.containsKey('intValue')) {
      intValue =
          jsonDecoder.decodeInt('$jsonPath.intValue', json['intValue']);
    }
    String? stringValue;
    if (json.containsKey('stringValue')) {
      stringValue = jsonDecoder.decodeString(
          '$jsonPath.stringValue', json['stringValue']);
    }
    FlutterWidgetPropertyValueEnumItem? enumValue;
    if (json.containsKey('enumValue')) {
      enumValue = FlutterWidgetPropertyValueEnumItem.fromJson(
          jsonDecoder, '$jsonPath.enumValue', json['enumValue']);
    }
    String? expression;
    if (json.containsKey('expression')) {
      expression = jsonDecoder.decodeString(
          '$jsonPath.expression', json['expression']);
    }
    return FlutterWidgetPropertyValue(
        boolValue: boolValue,
        doubleValue: doubleValue,
        intValue: intValue,
        stringValue: stringValue,
        enumValue: enumValue,
        expression: expression);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'FlutterWidgetPropertyValue', json);
  }
}