PluginDetailsResult.fromJson constructor

PluginDetailsResult.fromJson(
  1. JsonDecoder jsonDecoder,
  2. String jsonPath,
  3. Object? json, {
  4. ClientUriConverter? clientUriConverter,
})

Implementation

factory PluginDetailsResult.fromJson(
  JsonDecoder jsonDecoder,
  String jsonPath,
  Object? json, {
  ClientUriConverter? clientUriConverter,
}) {
  json ??= {};
  if (json is Map) {
    List<PluginDetails> plugins;
    if (json.containsKey('plugins')) {
      plugins = jsonDecoder.decodeList(
        '$jsonPath.plugins',
        json['plugins'],
        (String jsonPath, Object? json) => PluginDetails.fromJson(
          jsonDecoder,
          jsonPath,
          json,
          clientUriConverter: clientUriConverter,
        ),
      );
    } else {
      throw jsonDecoder.mismatch(jsonPath, "'plugins'", json);
    }
    return PluginDetailsResult(plugins);
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'plugin.details result'", json);
  }
}