FlutterGetWidgetDescriptionResult.fromJson constructor

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

Implementation

factory FlutterGetWidgetDescriptionResult.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    List<FlutterWidgetProperty> properties;
    if (json.containsKey('properties')) {
      properties = jsonDecoder.decodeList(
          '$jsonPath.properties',
          json['properties'],
          (String jsonPath, Object? json) =>
              FlutterWidgetProperty.fromJson(jsonDecoder, jsonPath, json));
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'properties');
    }
    return FlutterGetWidgetDescriptionResult(properties);
  } else {
    throw jsonDecoder.mismatch(
        jsonPath, 'flutter.getWidgetDescription result', json);
  }
}