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) {
    bool deleteSource;
    if (json.containsKey('deleteSource')) {
      deleteSource = jsonDecoder.decodeBool(
        '$jsonPath.deleteSource',
        json['deleteSource'],
      );
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'deleteSource');
    }
    bool inlineAll;
    if (json.containsKey('inlineAll')) {
      inlineAll = jsonDecoder.decodeBool(
        '$jsonPath.inlineAll',
        json['inlineAll'],
      );
    } else {
      throw jsonDecoder.mismatch(jsonPath, 'inlineAll');
    }
    return InlineMethodOptions(deleteSource, inlineAll);
  } else {
    throw jsonDecoder.mismatch(jsonPath, 'inlineMethod options', json);
  }
}