InlineMethodOptions.fromJson constructor

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

Implementation

factory InlineMethodOptions.fromJson(
  JsonDecoder jsonDecoder,
  String jsonPath,
  Object? json, {
  ClientUriConverter? clientUriConverter,
}) {
  json ??= {};
  if (json is! Map) {
    throw jsonDecoder.mismatch(jsonPath, "'inlineMethod options'", json);
  }
  bool deleteSource;
  if (json case {'deleteSource': var encodedDeleteSource}) {
    deleteSource = jsonDecoder.decodeBool(
      '$jsonPath.deleteSource',
      encodedDeleteSource,
    );
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'deleteSource'", json);
  }
  bool inlineAll;
  if (json case {'inlineAll': var encodedInlineAll}) {
    inlineAll = jsonDecoder.decodeBool(
      '$jsonPath.inlineAll',
      encodedInlineAll,
    );
  } else {
    throw jsonDecoder.mismatch(jsonPath, "'inlineAll'", json);
  }
  return InlineMethodOptions(deleteSource, inlineAll);
}