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) {
    throw jsonDecoder.mismatch(jsonPath, "'plugin.details result'", json);
  }
  List<PluginDetails> plugins;
  if (json case {'plugins': var encodedPlugins}) {
    plugins = jsonDecoder.decodeList(
      '$jsonPath.plugins',
      encodedPlugins,
      (String jsonPath, Object? json) => PluginDetails.fromJson(
        jsonDecoder,
        jsonPath,
        json,
        clientUriConverter: clientUriConverter,
      ),
    );
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'plugins'", json);
  }
  return PluginDetailsResult(plugins);
}