FlutterWidgetPropertyValueEnumItem.fromJson constructor

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

Implementation

factory FlutterWidgetPropertyValueEnumItem.fromJson(
    JsonDecoder jsonDecoder, String jsonPath, Object? json) {
  json ??= {};
  if (json is Map) {
    String libraryUri;
    if (json.containsKey('libraryUri')) {
      libraryUri = jsonDecoder.decodeString(
          '$jsonPath.libraryUri', json['libraryUri']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'libraryUri');
    }
    String className;
    if (json.containsKey('className')) {
      className =
          jsonDecoder.decodeString('$jsonPath.className', json['className']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'className');
    }
    String name;
    if (json.containsKey('name')) {
      name = jsonDecoder.decodeString('$jsonPath.name', json['name']);
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'name');
    }
    String? documentation;
    if (json.containsKey('documentation')) {
      documentation = jsonDecoder.decodeString(
          '$jsonPath.documentation', json['documentation']);
    }
    return FlutterWidgetPropertyValueEnumItem(libraryUri, className, name,
        documentation: documentation);
  } else {
    throw jsonDecoder.mismatch(
        jsonPath, 'FlutterWidgetPropertyValueEnumItem', json);
  }
}