FlutterWidgetPropertyEditor.fromJson constructor

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

Implementation

factory FlutterWidgetPropertyEditor.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    FlutterWidgetPropertyEditorKind kind;
    if (json.containsKey('kind')) {
      kind = FlutterWidgetPropertyEditorKind.fromJson(
          jsonDecoder, '$jsonPath.kind', json['kind']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'kind');
    }
    List<FlutterWidgetPropertyValueEnumItem>? enumItems;
    if (json.containsKey('enumItems')) {
      enumItems = jsonDecoder.decodeList(
          '$jsonPath.enumItems',
          json['enumItems'],
          (String jsonPath, Object? json) =>
              FlutterWidgetPropertyValueEnumItem.fromJson(
                  jsonDecoder, jsonPath, json));
    }
    return FlutterWidgetPropertyEditor(kind, enumItems: enumItems);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'FlutterWidgetPropertyEditor', json);
  }
}