// This file is automatically generated, so please do not edit it.
// @generated by `flutter_rust_bridge`@ 2.7.0.

// ignore_for_file: unused_import, unused_element, unnecessary_import, duplicate_ignore, invalid_use_of_internal_member, annotate_overrides, non_constant_identifier_names, curly_braces_in_flow_control_structures, prefer_const_literals_to_create_immutables, unused_field

import 'api/client.dart';
import 'api/error.dart';
import 'api/http.dart';
import 'api/stream.dart';
import 'dart:async';
import 'dart:convert';
import 'frb_generated.dart';
import 'frb_generated.io.dart'
    if (dart.library.js_interop) 'frb_generated.web.dart';
import 'lib.dart';
import 'package:flutter_rust_bridge/flutter_rust_bridge_for_generated.dart';

/// Main entrypoint of the Rust API
class RustLib extends BaseEntrypoint<RustLibApi, RustLibApiImpl, RustLibWire> {
  @internal
  static final instance = RustLib._();

  RustLib._();

  /// Initialize flutter_rust_bridge
  static Future<void> init({
    RustLibApi? api,
    BaseHandler? handler,
    ExternalLibrary? externalLibrary,
  }) async {
    await instance.initImpl(
      api: api,
      handler: handler,
      externalLibrary: externalLibrary,
    );
  }

  /// Initialize flutter_rust_bridge in mock mode.
  /// No libraries for FFI are loaded.
  static void initMock({
    required RustLibApi api,
  }) {
    instance.initMockImpl(
      api: api,
    );
  }

  /// Dispose flutter_rust_bridge
  ///
  /// The call to this function is optional, since flutter_rust_bridge (and everything else)
  /// is automatically disposed when the app stops.
  static void dispose() => instance.disposeImpl();

  @override
  ApiImplConstructor<RustLibApiImpl, RustLibWire> get apiImplConstructor =>
      RustLibApiImpl.new;

  @override
  WireConstructor<RustLibWire> get wireConstructor =>
      RustLibWire.fromExternalLibrary;

  @override
  Future<void> executeRustInitializers() async {
    await api.crateApiInitInitApp();
  }

  @override
  ExternalLibraryLoaderConfig get defaultExternalLibraryLoaderConfig =>
      kDefaultExternalLibraryLoaderConfig;

  @override
  String get codegenVersion => '2.7.0';

  @override
  int get rustContentHash => 2036241710;

  static const kDefaultExternalLibraryLoaderConfig =
      ExternalLibraryLoaderConfig(
        stem: 'rhttp',
        ioDirectory: 'rust/target/release/',
        webPrefix: 'pkg/',
      );
}

abstract class RustLibApi extends BaseApi {
  Future<void> crateApiStreamDart2RustStreamSinkAdd({
    required Dart2RustStreamSink that,
    required List<int> data,
  });

  Future<void> crateApiStreamDart2RustStreamSinkClose({
    required Dart2RustStreamSink that,
  });

  Future<void> crateApiHttpCancelRequest({required CancellationToken token});

  Future<void> crateApiHttpCancelRunningRequests({
    required RequestClient client,
  });

  Future<ClientSettings> crateApiClientClientSettingsDefault();

  DnsSettings crateApiClientCreateDynamicResolverSync({
    required FutureOr<List<String>> Function(String) resolver,
  });

  DnsSettings crateApiClientCreateStaticResolverSync({
    required StaticDnsSettings settings,
  });

  Future<(Dart2RustStreamSink, Dart2RustStreamReceiver)>
  crateApiStreamCreateStream();

  Future<void> crateApiInitInitApp();

  Future<HttpResponse> crateApiHttpMakeHttpRequest({
    RequestClient? client,
    ClientSettings? settings,
    required HttpMethod method,
    required String url,
    List<(String, String)>? query,
    HttpHeaders? headers,
    HttpBody? body,
    Dart2RustStreamReceiver? bodyStream,
    required HttpExpectBody expectBody,
    required FutureOr<void> Function(CancellationToken) onCancelToken,
    required bool cancelable,
  });

  Stream<Uint8List> crateApiHttpMakeHttpRequestReceiveStream({
    RequestClient? client,
    ClientSettings? settings,
    required HttpMethod method,
    required String url,
    List<(String, String)>? query,
    HttpHeaders? headers,
    HttpBody? body,
    Dart2RustStreamReceiver? bodyStream,
    required FutureOr<void> Function(HttpResponse) onResponse,
    required FutureOr<void> Function(RhttpError) onError,
    required FutureOr<void> Function(CancellationToken) onCancelToken,
    required bool cancelable,
  });

  Future<RequestClient> crateApiHttpRegisterClient({
    required ClientSettings settings,
  });

  RequestClient crateApiHttpRegisterClientSync({
    required ClientSettings settings,
  });

  RustArcIncrementStrongCountFnType
  get rust_arc_increment_strong_count_CancellationToken;

  RustArcDecrementStrongCountFnType
  get rust_arc_decrement_strong_count_CancellationToken;

  CrossPlatformFinalizerArg
  get rust_arc_decrement_strong_count_CancellationTokenPtr;

  RustArcIncrementStrongCountFnType
  get rust_arc_increment_strong_count_Dart2RustStreamReceiver;

  RustArcDecrementStrongCountFnType
  get rust_arc_decrement_strong_count_Dart2RustStreamReceiver;

  CrossPlatformFinalizerArg
  get rust_arc_decrement_strong_count_Dart2RustStreamReceiverPtr;

  RustArcIncrementStrongCountFnType
  get rust_arc_increment_strong_count_Dart2RustStreamSink;

  RustArcDecrementStrongCountFnType
  get rust_arc_decrement_strong_count_Dart2RustStreamSink;

  CrossPlatformFinalizerArg
  get rust_arc_decrement_strong_count_Dart2RustStreamSinkPtr;

  RustArcIncrementStrongCountFnType
  get rust_arc_increment_strong_count_DnsSettings;

  RustArcDecrementStrongCountFnType
  get rust_arc_decrement_strong_count_DnsSettings;

  CrossPlatformFinalizerArg get rust_arc_decrement_strong_count_DnsSettingsPtr;

  RustArcIncrementStrongCountFnType
  get rust_arc_increment_strong_count_RequestClient;

  RustArcDecrementStrongCountFnType
  get rust_arc_decrement_strong_count_RequestClient;

  CrossPlatformFinalizerArg
  get rust_arc_decrement_strong_count_RequestClientPtr;
}

class RustLibApiImpl extends RustLibApiImplPlatform implements RustLibApi {
  RustLibApiImpl({
    required super.handler,
    required super.wire,
    required super.generalizedFrbRustBinding,
    required super.portManager,
  });

  @override
  Future<void> crateApiStreamDart2RustStreamSinkAdd({
    required Dart2RustStreamSink that,
    required List<int> data,
  }) {
    return handler.executeNormal(
      NormalTask(
        callFfi: (port_) {
          final serializer = SseSerializer(generalizedFrbRustBinding);
          sse_encode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamSink(
            that,
            serializer,
          );
          sse_encode_list_prim_u_8_loose(data, serializer);
          pdeCallFfi(
            generalizedFrbRustBinding,
            serializer,
            funcId: 1,
            port: port_,
          );
        },
        codec: SseCodec(
          decodeSuccessData: sse_decode_unit,
          decodeErrorData: sse_decode_rhttp_error,
        ),
        constMeta: kCrateApiStreamDart2RustStreamSinkAddConstMeta,
        argValues: [that, data],
        apiImpl: this,
      ),
    );
  }

  TaskConstMeta get kCrateApiStreamDart2RustStreamSinkAddConstMeta =>
      const TaskConstMeta(
        debugName: "Dart2RustStreamSink_add",
        argNames: ["that", "data"],
      );

  @override
  Future<void> crateApiStreamDart2RustStreamSinkClose({
    required Dart2RustStreamSink that,
  }) {
    return handler.executeNormal(
      NormalTask(
        callFfi: (port_) {
          final serializer = SseSerializer(generalizedFrbRustBinding);
          sse_encode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamSink(
            that,
            serializer,
          );
          pdeCallFfi(
            generalizedFrbRustBinding,
            serializer,
            funcId: 2,
            port: port_,
          );
        },
        codec: SseCodec(
          decodeSuccessData: sse_decode_unit,
          decodeErrorData: sse_decode_rhttp_error,
        ),
        constMeta: kCrateApiStreamDart2RustStreamSinkCloseConstMeta,
        argValues: [that],
        apiImpl: this,
      ),
    );
  }

  TaskConstMeta get kCrateApiStreamDart2RustStreamSinkCloseConstMeta =>
      const TaskConstMeta(
        debugName: "Dart2RustStreamSink_close",
        argNames: ["that"],
      );

  @override
  Future<void> crateApiHttpCancelRequest({required CancellationToken token}) {
    return handler.executeNormal(
      NormalTask(
        callFfi: (port_) {
          final serializer = SseSerializer(generalizedFrbRustBinding);
          sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken(
            token,
            serializer,
          );
          pdeCallFfi(
            generalizedFrbRustBinding,
            serializer,
            funcId: 3,
            port: port_,
          );
        },
        codec: SseCodec(
          decodeSuccessData: sse_decode_unit,
          decodeErrorData: null,
        ),
        constMeta: kCrateApiHttpCancelRequestConstMeta,
        argValues: [token],
        apiImpl: this,
      ),
    );
  }

  TaskConstMeta get kCrateApiHttpCancelRequestConstMeta => const TaskConstMeta(
    debugName: "cancel_request",
    argNames: ["token"],
  );

  @override
  Future<void> crateApiHttpCancelRunningRequests({
    required RequestClient client,
  }) {
    return handler.executeNormal(
      NormalTask(
        callFfi: (port_) {
          final serializer = SseSerializer(generalizedFrbRustBinding);
          sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
            client,
            serializer,
          );
          pdeCallFfi(
            generalizedFrbRustBinding,
            serializer,
            funcId: 4,
            port: port_,
          );
        },
        codec: SseCodec(
          decodeSuccessData: sse_decode_unit,
          decodeErrorData: null,
        ),
        constMeta: kCrateApiHttpCancelRunningRequestsConstMeta,
        argValues: [client],
        apiImpl: this,
      ),
    );
  }

  TaskConstMeta get kCrateApiHttpCancelRunningRequestsConstMeta =>
      const TaskConstMeta(
        debugName: "cancel_running_requests",
        argNames: ["client"],
      );

  @override
  Future<ClientSettings> crateApiClientClientSettingsDefault() {
    return handler.executeNormal(
      NormalTask(
        callFfi: (port_) {
          final serializer = SseSerializer(generalizedFrbRustBinding);
          pdeCallFfi(
            generalizedFrbRustBinding,
            serializer,
            funcId: 5,
            port: port_,
          );
        },
        codec: SseCodec(
          decodeSuccessData: sse_decode_client_settings,
          decodeErrorData: null,
        ),
        constMeta: kCrateApiClientClientSettingsDefaultConstMeta,
        argValues: [],
        apiImpl: this,
      ),
    );
  }

  TaskConstMeta get kCrateApiClientClientSettingsDefaultConstMeta =>
      const TaskConstMeta(
        debugName: "client_settings_default",
        argNames: [],
      );

  @override
  DnsSettings crateApiClientCreateDynamicResolverSync({
    required FutureOr<List<String>> Function(String) resolver,
  }) {
    return handler.executeSync(
      SyncTask(
        callFfi: () {
          final serializer = SseSerializer(generalizedFrbRustBinding);
          sse_encode_DartFn_Inputs_String_Output_list_String_AnyhowException(
            resolver,
            serializer,
          );
          return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 6)!;
        },
        codec: SseCodec(
          decodeSuccessData:
              sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings,
          decodeErrorData: null,
        ),
        constMeta: kCrateApiClientCreateDynamicResolverSyncConstMeta,
        argValues: [resolver],
        apiImpl: this,
      ),
    );
  }

  TaskConstMeta get kCrateApiClientCreateDynamicResolverSyncConstMeta =>
      const TaskConstMeta(
        debugName: "create_dynamic_resolver_sync",
        argNames: ["resolver"],
      );

  @override
  DnsSettings crateApiClientCreateStaticResolverSync({
    required StaticDnsSettings settings,
  }) {
    return handler.executeSync(
      SyncTask(
        callFfi: () {
          final serializer = SseSerializer(generalizedFrbRustBinding);
          sse_encode_box_autoadd_static_dns_settings(settings, serializer);
          return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 7)!;
        },
        codec: SseCodec(
          decodeSuccessData:
              sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings,
          decodeErrorData: null,
        ),
        constMeta: kCrateApiClientCreateStaticResolverSyncConstMeta,
        argValues: [settings],
        apiImpl: this,
      ),
    );
  }

  TaskConstMeta get kCrateApiClientCreateStaticResolverSyncConstMeta =>
      const TaskConstMeta(
        debugName: "create_static_resolver_sync",
        argNames: ["settings"],
      );

  @override
  Future<(Dart2RustStreamSink, Dart2RustStreamReceiver)>
  crateApiStreamCreateStream() {
    return handler.executeNormal(
      NormalTask(
        callFfi: (port_) {
          final serializer = SseSerializer(generalizedFrbRustBinding);
          pdeCallFfi(
            generalizedFrbRustBinding,
            serializer,
            funcId: 8,
            port: port_,
          );
        },
        codec: SseCodec(
          decodeSuccessData:
              sse_decode_record_auto_owned_rust_opaque_flutter_rust_bridgefor_generated_rust_auto_opaque_inner_dart_2_rust_stream_sink_auto_owned_rust_opaque_flutter_rust_bridgefor_generated_rust_auto_opaque_inner_dart_2_rust_stream_receiver,
          decodeErrorData: null,
        ),
        constMeta: kCrateApiStreamCreateStreamConstMeta,
        argValues: [],
        apiImpl: this,
      ),
    );
  }

  TaskConstMeta get kCrateApiStreamCreateStreamConstMeta => const TaskConstMeta(
    debugName: "create_stream",
    argNames: [],
  );

  @override
  Future<void> crateApiInitInitApp() {
    return handler.executeNormal(
      NormalTask(
        callFfi: (port_) {
          final serializer = SseSerializer(generalizedFrbRustBinding);
          pdeCallFfi(
            generalizedFrbRustBinding,
            serializer,
            funcId: 9,
            port: port_,
          );
        },
        codec: SseCodec(
          decodeSuccessData: sse_decode_unit,
          decodeErrorData: null,
        ),
        constMeta: kCrateApiInitInitAppConstMeta,
        argValues: [],
        apiImpl: this,
      ),
    );
  }

  TaskConstMeta get kCrateApiInitInitAppConstMeta => const TaskConstMeta(
    debugName: "init_app",
    argNames: [],
  );

  @override
  Future<HttpResponse> crateApiHttpMakeHttpRequest({
    RequestClient? client,
    ClientSettings? settings,
    required HttpMethod method,
    required String url,
    List<(String, String)>? query,
    HttpHeaders? headers,
    HttpBody? body,
    Dart2RustStreamReceiver? bodyStream,
    required HttpExpectBody expectBody,
    required FutureOr<void> Function(CancellationToken) onCancelToken,
    required bool cancelable,
  }) {
    return handler.executeNormal(
      NormalTask(
        callFfi: (port_) {
          final serializer = SseSerializer(generalizedFrbRustBinding);
          sse_encode_opt_AutoExplicit_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
            client,
            serializer,
          );
          sse_encode_opt_box_autoadd_client_settings(settings, serializer);
          sse_encode_box_autoadd_http_method(method, serializer);
          sse_encode_String(url, serializer);
          sse_encode_opt_list_record_string_string(query, serializer);
          sse_encode_opt_box_autoadd_http_headers(headers, serializer);
          sse_encode_opt_box_autoadd_http_body(body, serializer);
          sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
            bodyStream,
            serializer,
          );
          sse_encode_http_expect_body(expectBody, serializer);
          sse_encode_DartFn_Inputs_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken_Output_unit_AnyhowException(
            onCancelToken,
            serializer,
          );
          sse_encode_bool(cancelable, serializer);
          pdeCallFfi(
            generalizedFrbRustBinding,
            serializer,
            funcId: 10,
            port: port_,
          );
        },
        codec: SseCodec(
          decodeSuccessData: sse_decode_http_response,
          decodeErrorData: sse_decode_rhttp_error,
        ),
        constMeta: kCrateApiHttpMakeHttpRequestConstMeta,
        argValues: [
          client,
          settings,
          method,
          url,
          query,
          headers,
          body,
          bodyStream,
          expectBody,
          onCancelToken,
          cancelable,
        ],
        apiImpl: this,
      ),
    );
  }

  TaskConstMeta get kCrateApiHttpMakeHttpRequestConstMeta =>
      const TaskConstMeta(
        debugName: "make_http_request",
        argNames: [
          "client",
          "settings",
          "method",
          "url",
          "query",
          "headers",
          "body",
          "bodyStream",
          "expectBody",
          "onCancelToken",
          "cancelable",
        ],
      );

  @override
  Stream<Uint8List> crateApiHttpMakeHttpRequestReceiveStream({
    RequestClient? client,
    ClientSettings? settings,
    required HttpMethod method,
    required String url,
    List<(String, String)>? query,
    HttpHeaders? headers,
    HttpBody? body,
    Dart2RustStreamReceiver? bodyStream,
    required FutureOr<void> Function(HttpResponse) onResponse,
    required FutureOr<void> Function(RhttpError) onError,
    required FutureOr<void> Function(CancellationToken) onCancelToken,
    required bool cancelable,
  }) {
    final streamSink = RustStreamSink<Uint8List>();
    unawaited(
      handler.executeNormal(
        NormalTask(
          callFfi: (port_) {
            final serializer = SseSerializer(generalizedFrbRustBinding);
            sse_encode_opt_AutoExplicit_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
              client,
              serializer,
            );
            sse_encode_opt_box_autoadd_client_settings(settings, serializer);
            sse_encode_box_autoadd_http_method(method, serializer);
            sse_encode_String(url, serializer);
            sse_encode_opt_list_record_string_string(query, serializer);
            sse_encode_opt_box_autoadd_http_headers(headers, serializer);
            sse_encode_opt_box_autoadd_http_body(body, serializer);
            sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
              bodyStream,
              serializer,
            );
            sse_encode_StreamSink_list_prim_u_8_strict_Sse(
              streamSink,
              serializer,
            );
            sse_encode_DartFn_Inputs_http_response_Output_unit_AnyhowException(
              onResponse,
              serializer,
            );
            sse_encode_DartFn_Inputs_rhttp_error_Output_unit_AnyhowException(
              onError,
              serializer,
            );
            sse_encode_DartFn_Inputs_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken_Output_unit_AnyhowException(
              onCancelToken,
              serializer,
            );
            sse_encode_bool(cancelable, serializer);
            pdeCallFfi(
              generalizedFrbRustBinding,
              serializer,
              funcId: 11,
              port: port_,
            );
          },
          codec: SseCodec(
            decodeSuccessData: sse_decode_unit,
            decodeErrorData: null,
          ),
          constMeta: kCrateApiHttpMakeHttpRequestReceiveStreamConstMeta,
          argValues: [
            client,
            settings,
            method,
            url,
            query,
            headers,
            body,
            bodyStream,
            streamSink,
            onResponse,
            onError,
            onCancelToken,
            cancelable,
          ],
          apiImpl: this,
        ),
      ),
    );
    return streamSink.stream;
  }

  TaskConstMeta get kCrateApiHttpMakeHttpRequestReceiveStreamConstMeta =>
      const TaskConstMeta(
        debugName: "make_http_request_receive_stream",
        argNames: [
          "client",
          "settings",
          "method",
          "url",
          "query",
          "headers",
          "body",
          "bodyStream",
          "streamSink",
          "onResponse",
          "onError",
          "onCancelToken",
          "cancelable",
        ],
      );

  @override
  Future<RequestClient> crateApiHttpRegisterClient({
    required ClientSettings settings,
  }) {
    return handler.executeNormal(
      NormalTask(
        callFfi: (port_) {
          final serializer = SseSerializer(generalizedFrbRustBinding);
          sse_encode_box_autoadd_client_settings(settings, serializer);
          pdeCallFfi(
            generalizedFrbRustBinding,
            serializer,
            funcId: 12,
            port: port_,
          );
        },
        codec: SseCodec(
          decodeSuccessData:
              sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient,
          decodeErrorData: sse_decode_rhttp_error,
        ),
        constMeta: kCrateApiHttpRegisterClientConstMeta,
        argValues: [settings],
        apiImpl: this,
      ),
    );
  }

  TaskConstMeta get kCrateApiHttpRegisterClientConstMeta => const TaskConstMeta(
    debugName: "register_client",
    argNames: ["settings"],
  );

  @override
  RequestClient crateApiHttpRegisterClientSync({
    required ClientSettings settings,
  }) {
    return handler.executeSync(
      SyncTask(
        callFfi: () {
          final serializer = SseSerializer(generalizedFrbRustBinding);
          sse_encode_box_autoadd_client_settings(settings, serializer);
          return pdeCallFfi(generalizedFrbRustBinding, serializer, funcId: 13)!;
        },
        codec: SseCodec(
          decodeSuccessData:
              sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient,
          decodeErrorData: sse_decode_rhttp_error,
        ),
        constMeta: kCrateApiHttpRegisterClientSyncConstMeta,
        argValues: [settings],
        apiImpl: this,
      ),
    );
  }

  TaskConstMeta get kCrateApiHttpRegisterClientSyncConstMeta =>
      const TaskConstMeta(
        debugName: "register_client_sync",
        argNames: ["settings"],
      );

  Future<void> Function(int, dynamic)
  encode_DartFn_Inputs_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken_Output_unit_AnyhowException(
    FutureOr<void> Function(CancellationToken) raw,
  ) {
    return (callId, rawArg0) async {
      final arg0 =
          dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken(
            rawArg0,
          );

      Box<void>? rawOutput;
      Box<AnyhowException>? rawError;
      try {
        rawOutput = Box(await raw(arg0));
      } catch (e, s) {
        rawError = Box(AnyhowException("$e\n\n$s"));
      }

      final serializer = SseSerializer(generalizedFrbRustBinding);
      assert((rawOutput != null) ^ (rawError != null));
      if (rawOutput != null) {
        serializer.buffer.putUint8(0);
        sse_encode_unit(rawOutput.value, serializer);
      } else {
        serializer.buffer.putUint8(1);
        sse_encode_AnyhowException(rawError!.value, serializer);
      }
      final output = serializer.intoRaw();

      generalizedFrbRustBinding.dartFnDeliverOutput(
        callId: callId,
        ptr: output.ptr,
        rustVecLen: output.rustVecLen,
        dataLen: output.dataLen,
      );
    };
  }

  Future<void> Function(int, dynamic)
  encode_DartFn_Inputs_String_Output_list_String_AnyhowException(
    FutureOr<List<String>> Function(String) raw,
  ) {
    return (callId, rawArg0) async {
      final arg0 = dco_decode_String(rawArg0);

      Box<List<String>>? rawOutput;
      Box<AnyhowException>? rawError;
      try {
        rawOutput = Box(await raw(arg0));
      } catch (e, s) {
        rawError = Box(AnyhowException("$e\n\n$s"));
      }

      final serializer = SseSerializer(generalizedFrbRustBinding);
      assert((rawOutput != null) ^ (rawError != null));
      if (rawOutput != null) {
        serializer.buffer.putUint8(0);
        sse_encode_list_String(rawOutput.value, serializer);
      } else {
        serializer.buffer.putUint8(1);
        sse_encode_AnyhowException(rawError!.value, serializer);
      }
      final output = serializer.intoRaw();

      generalizedFrbRustBinding.dartFnDeliverOutput(
        callId: callId,
        ptr: output.ptr,
        rustVecLen: output.rustVecLen,
        dataLen: output.dataLen,
      );
    };
  }

  Future<void> Function(int, dynamic)
  encode_DartFn_Inputs_http_response_Output_unit_AnyhowException(
    FutureOr<void> Function(HttpResponse) raw,
  ) {
    return (callId, rawArg0) async {
      final arg0 = dco_decode_http_response(rawArg0);

      Box<void>? rawOutput;
      Box<AnyhowException>? rawError;
      try {
        rawOutput = Box(await raw(arg0));
      } catch (e, s) {
        rawError = Box(AnyhowException("$e\n\n$s"));
      }

      final serializer = SseSerializer(generalizedFrbRustBinding);
      assert((rawOutput != null) ^ (rawError != null));
      if (rawOutput != null) {
        serializer.buffer.putUint8(0);
        sse_encode_unit(rawOutput.value, serializer);
      } else {
        serializer.buffer.putUint8(1);
        sse_encode_AnyhowException(rawError!.value, serializer);
      }
      final output = serializer.intoRaw();

      generalizedFrbRustBinding.dartFnDeliverOutput(
        callId: callId,
        ptr: output.ptr,
        rustVecLen: output.rustVecLen,
        dataLen: output.dataLen,
      );
    };
  }

  Future<void> Function(int, dynamic)
  encode_DartFn_Inputs_rhttp_error_Output_unit_AnyhowException(
    FutureOr<void> Function(RhttpError) raw,
  ) {
    return (callId, rawArg0) async {
      final arg0 = dco_decode_rhttp_error(rawArg0);

      Box<void>? rawOutput;
      Box<AnyhowException>? rawError;
      try {
        rawOutput = Box(await raw(arg0));
      } catch (e, s) {
        rawError = Box(AnyhowException("$e\n\n$s"));
      }

      final serializer = SseSerializer(generalizedFrbRustBinding);
      assert((rawOutput != null) ^ (rawError != null));
      if (rawOutput != null) {
        serializer.buffer.putUint8(0);
        sse_encode_unit(rawOutput.value, serializer);
      } else {
        serializer.buffer.putUint8(1);
        sse_encode_AnyhowException(rawError!.value, serializer);
      }
      final output = serializer.intoRaw();

      generalizedFrbRustBinding.dartFnDeliverOutput(
        callId: callId,
        ptr: output.ptr,
        rustVecLen: output.rustVecLen,
        dataLen: output.dataLen,
      );
    };
  }

  RustArcIncrementStrongCountFnType
  get rust_arc_increment_strong_count_CancellationToken => wire
      .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken;

  RustArcDecrementStrongCountFnType
  get rust_arc_decrement_strong_count_CancellationToken => wire
      .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken;

  RustArcIncrementStrongCountFnType
  get rust_arc_increment_strong_count_Dart2RustStreamReceiver => wire
      .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver;

  RustArcDecrementStrongCountFnType
  get rust_arc_decrement_strong_count_Dart2RustStreamReceiver => wire
      .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver;

  RustArcIncrementStrongCountFnType
  get rust_arc_increment_strong_count_Dart2RustStreamSink => wire
      .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamSink;

  RustArcDecrementStrongCountFnType
  get rust_arc_decrement_strong_count_Dart2RustStreamSink => wire
      .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamSink;

  RustArcIncrementStrongCountFnType
  get rust_arc_increment_strong_count_DnsSettings => wire
      .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings;

  RustArcDecrementStrongCountFnType
  get rust_arc_decrement_strong_count_DnsSettings => wire
      .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings;

  RustArcIncrementStrongCountFnType
  get rust_arc_increment_strong_count_RequestClient => wire
      .rust_arc_increment_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient;

  RustArcDecrementStrongCountFnType
  get rust_arc_decrement_strong_count_RequestClient => wire
      .rust_arc_decrement_strong_count_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient;

  @protected
  AnyhowException dco_decode_AnyhowException(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return AnyhowException(raw as String);
  }

  @protected
  RequestClient
  dco_decode_AutoExplicit_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
      raw,
    );
  }

  @protected
  CancellationToken
  dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return CancellationTokenImpl.frbInternalDcoDecode(raw as List<dynamic>);
  }

  @protected
  Dart2RustStreamReceiver
  dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return Dart2RustStreamReceiverImpl.frbInternalDcoDecode(
      raw as List<dynamic>,
    );
  }

  @protected
  Dart2RustStreamSink
  dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamSink(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return Dart2RustStreamSinkImpl.frbInternalDcoDecode(raw as List<dynamic>);
  }

  @protected
  DnsSettings
  dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return DnsSettingsImpl.frbInternalDcoDecode(raw as List<dynamic>);
  }

  @protected
  RequestClient
  dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return RequestClientImpl.frbInternalDcoDecode(raw as List<dynamic>);
  }

  @protected
  Dart2RustStreamSink
  dco_decode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamSink(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return Dart2RustStreamSinkImpl.frbInternalDcoDecode(raw as List<dynamic>);
  }

  @protected
  CancellationToken
  dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return CancellationTokenImpl.frbInternalDcoDecode(raw as List<dynamic>);
  }

  @protected
  RequestClient
  dco_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return RequestClientImpl.frbInternalDcoDecode(raw as List<dynamic>);
  }

  @protected
  Duration dco_decode_Chrono_Duration(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dcoDecodeDuration(dco_decode_i_64(raw).toInt());
  }

  @protected
  FutureOr<void> Function(CancellationToken)
  dco_decode_DartFn_Inputs_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken_Output_unit_AnyhowException(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    throw UnimplementedError('');
  }

  @protected
  FutureOr<List<String>> Function(String)
  dco_decode_DartFn_Inputs_String_Output_list_String_AnyhowException(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    throw UnimplementedError('');
  }

  @protected
  FutureOr<void> Function(HttpResponse)
  dco_decode_DartFn_Inputs_http_response_Output_unit_AnyhowException(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    throw UnimplementedError('');
  }

  @protected
  FutureOr<void> Function(RhttpError)
  dco_decode_DartFn_Inputs_rhttp_error_Output_unit_AnyhowException(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    throw UnimplementedError('');
  }

  @protected
  Object dco_decode_DartOpaque(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return decodeDartOpaque(raw, generalizedFrbRustBinding);
  }

  @protected
  Map<String, String> dco_decode_Map_String_String(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return Map.fromEntries(
      dco_decode_list_record_string_string(
        raw,
      ).map((e) => MapEntry(e.$1, e.$2)),
    );
  }

  @protected
  Map<String, List<String>> dco_decode_Map_String_list_String(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return Map.fromEntries(
      dco_decode_list_record_string_list_string(
        raw,
      ).map((e) => MapEntry(e.$1, e.$2)),
    );
  }

  @protected
  CancellationToken
  dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return CancellationTokenImpl.frbInternalDcoDecode(raw as List<dynamic>);
  }

  @protected
  Dart2RustStreamReceiver
  dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return Dart2RustStreamReceiverImpl.frbInternalDcoDecode(
      raw as List<dynamic>,
    );
  }

  @protected
  Dart2RustStreamSink
  dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamSink(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return Dart2RustStreamSinkImpl.frbInternalDcoDecode(raw as List<dynamic>);
  }

  @protected
  DnsSettings
  dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return DnsSettingsImpl.frbInternalDcoDecode(raw as List<dynamic>);
  }

  @protected
  RequestClient
  dco_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return RequestClientImpl.frbInternalDcoDecode(raw as List<dynamic>);
  }

  @protected
  RustStreamSink<Uint8List> dco_decode_StreamSink_list_prim_u_8_strict_Sse(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    throw UnimplementedError();
  }

  @protected
  String dco_decode_String(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw as String;
  }

  @protected
  bool dco_decode_bool(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw as bool;
  }

  @protected
  Dart2RustStreamReceiver
  dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
      raw,
    );
  }

  @protected
  DnsSettings
  dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings(
      raw,
    );
  }

  @protected
  Duration dco_decode_box_autoadd_Chrono_Duration(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dco_decode_Chrono_Duration(raw);
  }

  @protected
  ClientCertificate dco_decode_box_autoadd_client_certificate(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dco_decode_client_certificate(raw);
  }

  @protected
  ClientSettings dco_decode_box_autoadd_client_settings(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dco_decode_client_settings(raw);
  }

  @protected
  CookieSettings dco_decode_box_autoadd_cookie_settings(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dco_decode_cookie_settings(raw);
  }

  @protected
  HttpBody dco_decode_box_autoadd_http_body(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dco_decode_http_body(raw);
  }

  @protected
  HttpHeaders dco_decode_box_autoadd_http_headers(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dco_decode_http_headers(raw);
  }

  @protected
  HttpMethod dco_decode_box_autoadd_http_method(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dco_decode_http_method(raw);
  }

  @protected
  HttpResponseBody dco_decode_box_autoadd_http_response_body(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dco_decode_http_response_body(raw);
  }

  @protected
  MultipartPayload dco_decode_box_autoadd_multipart_payload(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dco_decode_multipart_payload(raw);
  }

  @protected
  ProxySettings dco_decode_box_autoadd_proxy_settings(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dco_decode_proxy_settings(raw);
  }

  @protected
  RedirectSettings dco_decode_box_autoadd_redirect_settings(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dco_decode_redirect_settings(raw);
  }

  @protected
  StaticDnsSettings dco_decode_box_autoadd_static_dns_settings(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dco_decode_static_dns_settings(raw);
  }

  @protected
  TimeoutSettings dco_decode_box_autoadd_timeout_settings(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dco_decode_timeout_settings(raw);
  }

  @protected
  TlsSettings dco_decode_box_autoadd_tls_settings(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dco_decode_tls_settings(raw);
  }

  @protected
  TlsVersion dco_decode_box_autoadd_tls_version(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dco_decode_tls_version(raw);
  }

  @protected
  ClientCertificate dco_decode_client_certificate(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    final arr = raw as List<dynamic>;
    if (arr.length != 2)
      throw Exception('unexpected arr length: expect 2 but see ${arr.length}');
    return ClientCertificate(
      certificate: dco_decode_list_prim_u_8_strict(arr[0]),
      privateKey: dco_decode_list_prim_u_8_strict(arr[1]),
    );
  }

  @protected
  ClientSettings dco_decode_client_settings(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    final arr = raw as List<dynamic>;
    if (arr.length != 11)
      throw Exception('unexpected arr length: expect 11 but see ${arr.length}');
    return ClientSettings(
      cookieSettings: dco_decode_opt_box_autoadd_cookie_settings(arr[0]),
      httpVersionPref: dco_decode_http_version_pref(arr[1]),
      timeoutSettings: dco_decode_opt_box_autoadd_timeout_settings(arr[2]),
      throwOnStatusCode: dco_decode_bool(arr[3]),
      enableEch: dco_decode_bool(arr[4]),
      requireEch: dco_decode_bool(arr[5]),
      proxySettings: dco_decode_opt_box_autoadd_proxy_settings(arr[6]),
      redirectSettings: dco_decode_opt_box_autoadd_redirect_settings(arr[7]),
      tlsSettings: dco_decode_opt_box_autoadd_tls_settings(arr[8]),
      dnsSettings:
          dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings(
            arr[9],
          ),
      userAgent: dco_decode_opt_String(arr[10]),
    );
  }

  @protected
  CookieSettings dco_decode_cookie_settings(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    final arr = raw as List<dynamic>;
    if (arr.length != 1)
      throw Exception('unexpected arr length: expect 1 but see ${arr.length}');
    return CookieSettings(
      storeCookies: dco_decode_bool(arr[0]),
    );
  }

  @protected
  CustomProxy dco_decode_custom_proxy(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    final arr = raw as List<dynamic>;
    if (arr.length != 2)
      throw Exception('unexpected arr length: expect 2 but see ${arr.length}');
    return CustomProxy(
      url: dco_decode_String(arr[0]),
      condition: dco_decode_proxy_condition(arr[1]),
    );
  }

  @protected
  HttpBody dco_decode_http_body(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    switch (raw[0]) {
      case 0:
        return HttpBody_Text(
          dco_decode_String(raw[1]),
        );
      case 1:
        return HttpBody_Bytes(
          dco_decode_list_prim_u_8_strict(raw[1]),
        );
      case 2:
        return HttpBody_BytesStream();
      case 3:
        return HttpBody_Form(
          dco_decode_Map_String_String(raw[1]),
        );
      case 4:
        return HttpBody_Multipart(
          dco_decode_box_autoadd_multipart_payload(raw[1]),
        );
      default:
        throw Exception("unreachable");
    }
  }

  @protected
  HttpExpectBody dco_decode_http_expect_body(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return HttpExpectBody.values[raw as int];
  }

  @protected
  HttpHeaders dco_decode_http_headers(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    switch (raw[0]) {
      case 0:
        return HttpHeaders_Map(
          dco_decode_Map_String_String(raw[1]),
        );
      case 1:
        return HttpHeaders_List(
          dco_decode_list_record_string_string(raw[1]),
        );
      default:
        throw Exception("unreachable");
    }
  }

  @protected
  HttpMethod dco_decode_http_method(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    final arr = raw as List<dynamic>;
    if (arr.length != 1)
      throw Exception('unexpected arr length: expect 1 but see ${arr.length}');
    return HttpMethod(
      method: dco_decode_String(arr[0]),
    );
  }

  @protected
  HttpResponse dco_decode_http_response(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    final arr = raw as List<dynamic>;
    if (arr.length != 5)
      throw Exception('unexpected arr length: expect 5 but see ${arr.length}');
    return HttpResponse(
      remoteIp: dco_decode_opt_String(arr[0]),
      headers: dco_decode_list_record_string_string(arr[1]),
      version: dco_decode_http_version(arr[2]),
      statusCode: dco_decode_u_16(arr[3]),
      body: dco_decode_http_response_body(arr[4]),
    );
  }

  @protected
  HttpResponseBody dco_decode_http_response_body(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    switch (raw[0]) {
      case 0:
        return HttpResponseBody_Text(
          dco_decode_String(raw[1]),
        );
      case 1:
        return HttpResponseBody_Bytes(
          dco_decode_list_prim_u_8_strict(raw[1]),
        );
      case 2:
        return HttpResponseBody_Stream();
      default:
        throw Exception("unreachable");
    }
  }

  @protected
  HttpVersion dco_decode_http_version(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return HttpVersion.values[raw as int];
  }

  @protected
  HttpVersionPref dco_decode_http_version_pref(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return HttpVersionPref.values[raw as int];
  }

  @protected
  int dco_decode_i_32(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw as int;
  }

  @protected
  PlatformInt64 dco_decode_i_64(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dcoDecodeI64(raw);
  }

  @protected
  PlatformInt64 dco_decode_isize(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dcoDecodeI64(raw);
  }

  @protected
  List<String> dco_decode_list_String(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return (raw as List<dynamic>).map(dco_decode_String).toList();
  }

  @protected
  List<CustomProxy> dco_decode_list_custom_proxy(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return (raw as List<dynamic>).map(dco_decode_custom_proxy).toList();
  }

  @protected
  List<Uint8List> dco_decode_list_list_prim_u_8_strict(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return (raw as List<dynamic>).map(dco_decode_list_prim_u_8_strict).toList();
  }

  @protected
  List<int> dco_decode_list_prim_u_8_loose(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw as List<int>;
  }

  @protected
  Uint8List dco_decode_list_prim_u_8_strict(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw as Uint8List;
  }

  @protected
  List<(String, List<String>)> dco_decode_list_record_string_list_string(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return (raw as List<dynamic>)
        .map(dco_decode_record_string_list_string)
        .toList();
  }

  @protected
  List<(String, MultipartItem)> dco_decode_list_record_string_multipart_item(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return (raw as List<dynamic>)
        .map(dco_decode_record_string_multipart_item)
        .toList();
  }

  @protected
  List<(String, String)> dco_decode_list_record_string_string(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return (raw as List<dynamic>).map(dco_decode_record_string_string).toList();
  }

  @protected
  MultipartItem dco_decode_multipart_item(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    final arr = raw as List<dynamic>;
    if (arr.length != 3)
      throw Exception('unexpected arr length: expect 3 but see ${arr.length}');
    return MultipartItem(
      value: dco_decode_multipart_value(arr[0]),
      fileName: dco_decode_opt_String(arr[1]),
      contentType: dco_decode_opt_String(arr[2]),
    );
  }

  @protected
  MultipartPayload dco_decode_multipart_payload(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    final arr = raw as List<dynamic>;
    if (arr.length != 1)
      throw Exception('unexpected arr length: expect 1 but see ${arr.length}');
    return MultipartPayload(
      parts: dco_decode_list_record_string_multipart_item(arr[0]),
    );
  }

  @protected
  MultipartValue dco_decode_multipart_value(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    switch (raw[0]) {
      case 0:
        return MultipartValue_Text(
          dco_decode_String(raw[1]),
        );
      case 1:
        return MultipartValue_Bytes(
          dco_decode_list_prim_u_8_strict(raw[1]),
        );
      case 2:
        return MultipartValue_File(
          dco_decode_String(raw[1]),
        );
      default:
        throw Exception("unreachable");
    }
  }

  @protected
  RequestClient?
  dco_decode_opt_AutoExplicit_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw == null
        ? null
        : dco_decode_AutoExplicit_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
            raw,
          );
  }

  @protected
  String? dco_decode_opt_String(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw == null ? null : dco_decode_String(raw);
  }

  @protected
  Dart2RustStreamReceiver?
  dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw == null
        ? null
        : dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
            raw,
          );
  }

  @protected
  DnsSettings?
  dco_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw == null
        ? null
        : dco_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings(
            raw,
          );
  }

  @protected
  Duration? dco_decode_opt_box_autoadd_Chrono_Duration(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw == null ? null : dco_decode_box_autoadd_Chrono_Duration(raw);
  }

  @protected
  ClientCertificate? dco_decode_opt_box_autoadd_client_certificate(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw == null ? null : dco_decode_box_autoadd_client_certificate(raw);
  }

  @protected
  ClientSettings? dco_decode_opt_box_autoadd_client_settings(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw == null ? null : dco_decode_box_autoadd_client_settings(raw);
  }

  @protected
  CookieSettings? dco_decode_opt_box_autoadd_cookie_settings(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw == null ? null : dco_decode_box_autoadd_cookie_settings(raw);
  }

  @protected
  HttpBody? dco_decode_opt_box_autoadd_http_body(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw == null ? null : dco_decode_box_autoadd_http_body(raw);
  }

  @protected
  HttpHeaders? dco_decode_opt_box_autoadd_http_headers(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw == null ? null : dco_decode_box_autoadd_http_headers(raw);
  }

  @protected
  ProxySettings? dco_decode_opt_box_autoadd_proxy_settings(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw == null ? null : dco_decode_box_autoadd_proxy_settings(raw);
  }

  @protected
  RedirectSettings? dco_decode_opt_box_autoadd_redirect_settings(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw == null ? null : dco_decode_box_autoadd_redirect_settings(raw);
  }

  @protected
  TimeoutSettings? dco_decode_opt_box_autoadd_timeout_settings(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw == null ? null : dco_decode_box_autoadd_timeout_settings(raw);
  }

  @protected
  TlsSettings? dco_decode_opt_box_autoadd_tls_settings(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw == null ? null : dco_decode_box_autoadd_tls_settings(raw);
  }

  @protected
  TlsVersion? dco_decode_opt_box_autoadd_tls_version(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw == null ? null : dco_decode_box_autoadd_tls_version(raw);
  }

  @protected
  List<(String, String)>? dco_decode_opt_list_record_string_string(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw == null ? null : dco_decode_list_record_string_string(raw);
  }

  @protected
  ProxyCondition dco_decode_proxy_condition(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return ProxyCondition.values[raw as int];
  }

  @protected
  ProxySettings dco_decode_proxy_settings(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    switch (raw[0]) {
      case 0:
        return ProxySettings_NoProxy();
      case 1:
        return ProxySettings_CustomProxyList(
          dco_decode_list_custom_proxy(raw[1]),
        );
      default:
        throw Exception("unreachable");
    }
  }

  @protected
  (Dart2RustStreamSink, Dart2RustStreamReceiver)
  dco_decode_record_auto_owned_rust_opaque_flutter_rust_bridgefor_generated_rust_auto_opaque_inner_dart_2_rust_stream_sink_auto_owned_rust_opaque_flutter_rust_bridgefor_generated_rust_auto_opaque_inner_dart_2_rust_stream_receiver(
    dynamic raw,
  ) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    final arr = raw as List<dynamic>;
    if (arr.length != 2) {
      throw Exception('Expected 2 elements, got ${arr.length}');
    }
    return (
      dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamSink(
        arr[0],
      ),
      dco_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
        arr[1],
      ),
    );
  }

  @protected
  (String, List<String>) dco_decode_record_string_list_string(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    final arr = raw as List<dynamic>;
    if (arr.length != 2) {
      throw Exception('Expected 2 elements, got ${arr.length}');
    }
    return (
      dco_decode_String(arr[0]),
      dco_decode_list_String(arr[1]),
    );
  }

  @protected
  (String, MultipartItem) dco_decode_record_string_multipart_item(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    final arr = raw as List<dynamic>;
    if (arr.length != 2) {
      throw Exception('Expected 2 elements, got ${arr.length}');
    }
    return (
      dco_decode_String(arr[0]),
      dco_decode_multipart_item(arr[1]),
    );
  }

  @protected
  (String, String) dco_decode_record_string_string(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    final arr = raw as List<dynamic>;
    if (arr.length != 2) {
      throw Exception('Expected 2 elements, got ${arr.length}');
    }
    return (
      dco_decode_String(arr[0]),
      dco_decode_String(arr[1]),
    );
  }

  @protected
  RedirectSettings dco_decode_redirect_settings(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    switch (raw[0]) {
      case 0:
        return RedirectSettings_NoRedirect();
      case 1:
        return RedirectSettings_LimitedRedirects(
          dco_decode_i_32(raw[1]),
        );
      default:
        throw Exception("unreachable");
    }
  }

  @protected
  RhttpError dco_decode_rhttp_error(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    switch (raw[0]) {
      case 0:
        return RhttpError_RhttpCancelError();
      case 1:
        return RhttpError_RhttpTimeoutError();
      case 2:
        return RhttpError_RhttpRedirectError();
      case 3:
        return RhttpError_RhttpStatusCodeError(
          dco_decode_u_16(raw[1]),
          dco_decode_list_record_string_string(raw[2]),
          dco_decode_box_autoadd_http_response_body(raw[3]),
        );
      case 4:
        return RhttpError_RhttpInvalidCertificateError(
          dco_decode_String(raw[1]),
        );
      case 5:
        return RhttpError_RhttpConnectionError(
          dco_decode_String(raw[1]),
        );
      case 6:
        return RhttpError_RhttpUnknownError(
          dco_decode_String(raw[1]),
        );
      default:
        throw Exception("unreachable");
    }
  }

  @protected
  RootCertSource dco_decode_root_cert_source(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return RootCertSource.values[raw as int];
  }

  @protected
  StaticDnsSettings dco_decode_static_dns_settings(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    final arr = raw as List<dynamic>;
    if (arr.length != 2)
      throw Exception('unexpected arr length: expect 2 but see ${arr.length}');
    return StaticDnsSettings(
      overrides: dco_decode_Map_String_list_String(arr[0]),
      fallback: dco_decode_opt_String(arr[1]),
    );
  }

  @protected
  TimeoutSettings dco_decode_timeout_settings(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    final arr = raw as List<dynamic>;
    if (arr.length != 4)
      throw Exception('unexpected arr length: expect 4 but see ${arr.length}');
    return TimeoutSettings(
      timeout: dco_decode_opt_box_autoadd_Chrono_Duration(arr[0]),
      connectTimeout: dco_decode_opt_box_autoadd_Chrono_Duration(arr[1]),
      keepAliveTimeout: dco_decode_opt_box_autoadd_Chrono_Duration(arr[2]),
      keepAlivePing: dco_decode_opt_box_autoadd_Chrono_Duration(arr[3]),
    );
  }

  @protected
  TlsSettings dco_decode_tls_settings(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    final arr = raw as List<dynamic>;
    if (arr.length != 7)
      throw Exception('unexpected arr length: expect 7 but see ${arr.length}');
    return TlsSettings(
      rootCertSource: dco_decode_root_cert_source(arr[0]),
      trustedRootCertificates: dco_decode_list_list_prim_u_8_strict(arr[1]),
      verifyCertificates: dco_decode_bool(arr[2]),
      clientCertificate: dco_decode_opt_box_autoadd_client_certificate(arr[3]),
      minTlsVersion: dco_decode_opt_box_autoadd_tls_version(arr[4]),
      maxTlsVersion: dco_decode_opt_box_autoadd_tls_version(arr[5]),
      sni: dco_decode_bool(arr[6]),
    );
  }

  @protected
  TlsVersion dco_decode_tls_version(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return TlsVersion.values[raw as int];
  }

  @protected
  int dco_decode_u_16(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw as int;
  }

  @protected
  int dco_decode_u_8(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return raw as int;
  }

  @protected
  void dco_decode_unit(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return;
  }

  @protected
  BigInt dco_decode_usize(dynamic raw) {
    // Codec=Dco (DartCObject based), see doc to use other codecs
    return dcoDecodeU64(raw);
  }

  @protected
  AnyhowException sse_decode_AnyhowException(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var inner = sse_decode_String(deserializer);
    return AnyhowException(inner);
  }

  @protected
  RequestClient
  sse_decode_AutoExplicit_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var inner =
        sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
          deserializer,
        );
    return inner;
  }

  @protected
  CancellationToken
  sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return CancellationTokenImpl.frbInternalSseDecode(
      sse_decode_usize(deserializer),
      sse_decode_i_32(deserializer),
    );
  }

  @protected
  Dart2RustStreamReceiver
  sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return Dart2RustStreamReceiverImpl.frbInternalSseDecode(
      sse_decode_usize(deserializer),
      sse_decode_i_32(deserializer),
    );
  }

  @protected
  Dart2RustStreamSink
  sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamSink(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return Dart2RustStreamSinkImpl.frbInternalSseDecode(
      sse_decode_usize(deserializer),
      sse_decode_i_32(deserializer),
    );
  }

  @protected
  DnsSettings
  sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return DnsSettingsImpl.frbInternalSseDecode(
      sse_decode_usize(deserializer),
      sse_decode_i_32(deserializer),
    );
  }

  @protected
  RequestClient
  sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return RequestClientImpl.frbInternalSseDecode(
      sse_decode_usize(deserializer),
      sse_decode_i_32(deserializer),
    );
  }

  @protected
  Dart2RustStreamSink
  sse_decode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamSink(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return Dart2RustStreamSinkImpl.frbInternalSseDecode(
      sse_decode_usize(deserializer),
      sse_decode_i_32(deserializer),
    );
  }

  @protected
  CancellationToken
  sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return CancellationTokenImpl.frbInternalSseDecode(
      sse_decode_usize(deserializer),
      sse_decode_i_32(deserializer),
    );
  }

  @protected
  RequestClient
  sse_decode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return RequestClientImpl.frbInternalSseDecode(
      sse_decode_usize(deserializer),
      sse_decode_i_32(deserializer),
    );
  }

  @protected
  Duration sse_decode_Chrono_Duration(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var inner = sse_decode_i_64(deserializer);
    return Duration(microseconds: inner.toInt());
  }

  @protected
  Object sse_decode_DartOpaque(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var inner = sse_decode_isize(deserializer);
    return decodeDartOpaque(inner, generalizedFrbRustBinding);
  }

  @protected
  Map<String, String> sse_decode_Map_String_String(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var inner = sse_decode_list_record_string_string(deserializer);
    return Map.fromEntries(inner.map((e) => MapEntry(e.$1, e.$2)));
  }

  @protected
  Map<String, List<String>> sse_decode_Map_String_list_String(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var inner = sse_decode_list_record_string_list_string(deserializer);
    return Map.fromEntries(inner.map((e) => MapEntry(e.$1, e.$2)));
  }

  @protected
  CancellationToken
  sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return CancellationTokenImpl.frbInternalSseDecode(
      sse_decode_usize(deserializer),
      sse_decode_i_32(deserializer),
    );
  }

  @protected
  Dart2RustStreamReceiver
  sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return Dart2RustStreamReceiverImpl.frbInternalSseDecode(
      sse_decode_usize(deserializer),
      sse_decode_i_32(deserializer),
    );
  }

  @protected
  Dart2RustStreamSink
  sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamSink(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return Dart2RustStreamSinkImpl.frbInternalSseDecode(
      sse_decode_usize(deserializer),
      sse_decode_i_32(deserializer),
    );
  }

  @protected
  DnsSettings
  sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return DnsSettingsImpl.frbInternalSseDecode(
      sse_decode_usize(deserializer),
      sse_decode_i_32(deserializer),
    );
  }

  @protected
  RequestClient
  sse_decode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return RequestClientImpl.frbInternalSseDecode(
      sse_decode_usize(deserializer),
      sse_decode_i_32(deserializer),
    );
  }

  @protected
  RustStreamSink<Uint8List> sse_decode_StreamSink_list_prim_u_8_strict_Sse(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    throw UnimplementedError('Unreachable ()');
  }

  @protected
  String sse_decode_String(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var inner = sse_decode_list_prim_u_8_strict(deserializer);
    return utf8.decoder.convert(inner);
  }

  @protected
  bool sse_decode_bool(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return deserializer.buffer.getUint8() != 0;
  }

  @protected
  Dart2RustStreamReceiver
  sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return (sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
      deserializer,
    ));
  }

  @protected
  DnsSettings
  sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return (sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings(
      deserializer,
    ));
  }

  @protected
  Duration sse_decode_box_autoadd_Chrono_Duration(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return (sse_decode_Chrono_Duration(deserializer));
  }

  @protected
  ClientCertificate sse_decode_box_autoadd_client_certificate(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return (sse_decode_client_certificate(deserializer));
  }

  @protected
  ClientSettings sse_decode_box_autoadd_client_settings(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return (sse_decode_client_settings(deserializer));
  }

  @protected
  CookieSettings sse_decode_box_autoadd_cookie_settings(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return (sse_decode_cookie_settings(deserializer));
  }

  @protected
  HttpBody sse_decode_box_autoadd_http_body(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return (sse_decode_http_body(deserializer));
  }

  @protected
  HttpHeaders sse_decode_box_autoadd_http_headers(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return (sse_decode_http_headers(deserializer));
  }

  @protected
  HttpMethod sse_decode_box_autoadd_http_method(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return (sse_decode_http_method(deserializer));
  }

  @protected
  HttpResponseBody sse_decode_box_autoadd_http_response_body(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return (sse_decode_http_response_body(deserializer));
  }

  @protected
  MultipartPayload sse_decode_box_autoadd_multipart_payload(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return (sse_decode_multipart_payload(deserializer));
  }

  @protected
  ProxySettings sse_decode_box_autoadd_proxy_settings(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return (sse_decode_proxy_settings(deserializer));
  }

  @protected
  RedirectSettings sse_decode_box_autoadd_redirect_settings(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return (sse_decode_redirect_settings(deserializer));
  }

  @protected
  StaticDnsSettings sse_decode_box_autoadd_static_dns_settings(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return (sse_decode_static_dns_settings(deserializer));
  }

  @protected
  TimeoutSettings sse_decode_box_autoadd_timeout_settings(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return (sse_decode_timeout_settings(deserializer));
  }

  @protected
  TlsSettings sse_decode_box_autoadd_tls_settings(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return (sse_decode_tls_settings(deserializer));
  }

  @protected
  TlsVersion sse_decode_box_autoadd_tls_version(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return (sse_decode_tls_version(deserializer));
  }

  @protected
  ClientCertificate sse_decode_client_certificate(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var var_certificate = sse_decode_list_prim_u_8_strict(deserializer);
    var var_privateKey = sse_decode_list_prim_u_8_strict(deserializer);
    return ClientCertificate(
      certificate: var_certificate,
      privateKey: var_privateKey,
    );
  }

  @protected
  ClientSettings sse_decode_client_settings(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var var_cookieSettings = sse_decode_opt_box_autoadd_cookie_settings(
      deserializer,
    );
    var var_httpVersionPref = sse_decode_http_version_pref(deserializer);
    var var_timeoutSettings = sse_decode_opt_box_autoadd_timeout_settings(
      deserializer,
    );
    var var_throwOnStatusCode = sse_decode_bool(deserializer);
    var var_enableEch = sse_decode_bool(deserializer);
    var var_requireEch = sse_decode_bool(deserializer);
    var var_proxySettings = sse_decode_opt_box_autoadd_proxy_settings(
      deserializer,
    );
    var var_redirectSettings = sse_decode_opt_box_autoadd_redirect_settings(
      deserializer,
    );
    var var_tlsSettings = sse_decode_opt_box_autoadd_tls_settings(deserializer);
    var var_dnsSettings =
        sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings(
          deserializer,
        );
    var var_userAgent = sse_decode_opt_String(deserializer);
    return ClientSettings(
      cookieSettings: var_cookieSettings,
      httpVersionPref: var_httpVersionPref,
      timeoutSettings: var_timeoutSettings,
      throwOnStatusCode: var_throwOnStatusCode,
      enableEch: var_enableEch,
      requireEch: var_requireEch,
      proxySettings: var_proxySettings,
      redirectSettings: var_redirectSettings,
      tlsSettings: var_tlsSettings,
      dnsSettings: var_dnsSettings,
      userAgent: var_userAgent,
    );
  }

  @protected
  CookieSettings sse_decode_cookie_settings(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var var_storeCookies = sse_decode_bool(deserializer);
    return CookieSettings(storeCookies: var_storeCookies);
  }

  @protected
  CustomProxy sse_decode_custom_proxy(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var var_url = sse_decode_String(deserializer);
    var var_condition = sse_decode_proxy_condition(deserializer);
    return CustomProxy(url: var_url, condition: var_condition);
  }

  @protected
  HttpBody sse_decode_http_body(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    var tag_ = sse_decode_i_32(deserializer);
    switch (tag_) {
      case 0:
        var var_field0 = sse_decode_String(deserializer);
        return HttpBody_Text(var_field0);
      case 1:
        var var_field0 = sse_decode_list_prim_u_8_strict(deserializer);
        return HttpBody_Bytes(var_field0);
      case 2:
        return HttpBody_BytesStream();
      case 3:
        var var_field0 = sse_decode_Map_String_String(deserializer);
        return HttpBody_Form(var_field0);
      case 4:
        var var_field0 = sse_decode_box_autoadd_multipart_payload(deserializer);
        return HttpBody_Multipart(var_field0);
      default:
        throw UnimplementedError('');
    }
  }

  @protected
  HttpExpectBody sse_decode_http_expect_body(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var inner = sse_decode_i_32(deserializer);
    return HttpExpectBody.values[inner];
  }

  @protected
  HttpHeaders sse_decode_http_headers(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    var tag_ = sse_decode_i_32(deserializer);
    switch (tag_) {
      case 0:
        var var_field0 = sse_decode_Map_String_String(deserializer);
        return HttpHeaders_Map(var_field0);
      case 1:
        var var_field0 = sse_decode_list_record_string_string(deserializer);
        return HttpHeaders_List(var_field0);
      default:
        throw UnimplementedError('');
    }
  }

  @protected
  HttpMethod sse_decode_http_method(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var var_method = sse_decode_String(deserializer);
    return HttpMethod(method: var_method);
  }

  @protected
  HttpResponse sse_decode_http_response(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var var_remoteIp = sse_decode_opt_String(deserializer);
    var var_headers = sse_decode_list_record_string_string(deserializer);
    var var_version = sse_decode_http_version(deserializer);
    var var_statusCode = sse_decode_u_16(deserializer);
    var var_body = sse_decode_http_response_body(deserializer);
    return HttpResponse(
      remoteIp: var_remoteIp,
      headers: var_headers,
      version: var_version,
      statusCode: var_statusCode,
      body: var_body,
    );
  }

  @protected
  HttpResponseBody sse_decode_http_response_body(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    var tag_ = sse_decode_i_32(deserializer);
    switch (tag_) {
      case 0:
        var var_field0 = sse_decode_String(deserializer);
        return HttpResponseBody_Text(var_field0);
      case 1:
        var var_field0 = sse_decode_list_prim_u_8_strict(deserializer);
        return HttpResponseBody_Bytes(var_field0);
      case 2:
        return HttpResponseBody_Stream();
      default:
        throw UnimplementedError('');
    }
  }

  @protected
  HttpVersion sse_decode_http_version(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var inner = sse_decode_i_32(deserializer);
    return HttpVersion.values[inner];
  }

  @protected
  HttpVersionPref sse_decode_http_version_pref(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var inner = sse_decode_i_32(deserializer);
    return HttpVersionPref.values[inner];
  }

  @protected
  int sse_decode_i_32(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return deserializer.buffer.getInt32();
  }

  @protected
  PlatformInt64 sse_decode_i_64(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return deserializer.buffer.getPlatformInt64();
  }

  @protected
  PlatformInt64 sse_decode_isize(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return deserializer.buffer.getPlatformInt64();
  }

  @protected
  List<String> sse_decode_list_String(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    var len_ = sse_decode_i_32(deserializer);
    var ans_ = <String>[];
    for (var idx_ = 0; idx_ < len_; ++idx_) {
      ans_.add(sse_decode_String(deserializer));
    }
    return ans_;
  }

  @protected
  List<CustomProxy> sse_decode_list_custom_proxy(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    var len_ = sse_decode_i_32(deserializer);
    var ans_ = <CustomProxy>[];
    for (var idx_ = 0; idx_ < len_; ++idx_) {
      ans_.add(sse_decode_custom_proxy(deserializer));
    }
    return ans_;
  }

  @protected
  List<Uint8List> sse_decode_list_list_prim_u_8_strict(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    var len_ = sse_decode_i_32(deserializer);
    var ans_ = <Uint8List>[];
    for (var idx_ = 0; idx_ < len_; ++idx_) {
      ans_.add(sse_decode_list_prim_u_8_strict(deserializer));
    }
    return ans_;
  }

  @protected
  List<int> sse_decode_list_prim_u_8_loose(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var len_ = sse_decode_i_32(deserializer);
    return deserializer.buffer.getUint8List(len_);
  }

  @protected
  Uint8List sse_decode_list_prim_u_8_strict(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var len_ = sse_decode_i_32(deserializer);
    return deserializer.buffer.getUint8List(len_);
  }

  @protected
  List<(String, List<String>)> sse_decode_list_record_string_list_string(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    var len_ = sse_decode_i_32(deserializer);
    var ans_ = <(String, List<String>)>[];
    for (var idx_ = 0; idx_ < len_; ++idx_) {
      ans_.add(sse_decode_record_string_list_string(deserializer));
    }
    return ans_;
  }

  @protected
  List<(String, MultipartItem)> sse_decode_list_record_string_multipart_item(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    var len_ = sse_decode_i_32(deserializer);
    var ans_ = <(String, MultipartItem)>[];
    for (var idx_ = 0; idx_ < len_; ++idx_) {
      ans_.add(sse_decode_record_string_multipart_item(deserializer));
    }
    return ans_;
  }

  @protected
  List<(String, String)> sse_decode_list_record_string_string(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    var len_ = sse_decode_i_32(deserializer);
    var ans_ = <(String, String)>[];
    for (var idx_ = 0; idx_ < len_; ++idx_) {
      ans_.add(sse_decode_record_string_string(deserializer));
    }
    return ans_;
  }

  @protected
  MultipartItem sse_decode_multipart_item(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var var_value = sse_decode_multipart_value(deserializer);
    var var_fileName = sse_decode_opt_String(deserializer);
    var var_contentType = sse_decode_opt_String(deserializer);
    return MultipartItem(
      value: var_value,
      fileName: var_fileName,
      contentType: var_contentType,
    );
  }

  @protected
  MultipartPayload sse_decode_multipart_payload(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var var_parts = sse_decode_list_record_string_multipart_item(deserializer);
    return MultipartPayload(parts: var_parts);
  }

  @protected
  MultipartValue sse_decode_multipart_value(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    var tag_ = sse_decode_i_32(deserializer);
    switch (tag_) {
      case 0:
        var var_field0 = sse_decode_String(deserializer);
        return MultipartValue_Text(var_field0);
      case 1:
        var var_field0 = sse_decode_list_prim_u_8_strict(deserializer);
        return MultipartValue_Bytes(var_field0);
      case 2:
        var var_field0 = sse_decode_String(deserializer);
        return MultipartValue_File(var_field0);
      default:
        throw UnimplementedError('');
    }
  }

  @protected
  RequestClient?
  sse_decode_opt_AutoExplicit_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    if (sse_decode_bool(deserializer)) {
      return (sse_decode_AutoExplicit_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
        deserializer,
      ));
    } else {
      return null;
    }
  }

  @protected
  String? sse_decode_opt_String(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    if (sse_decode_bool(deserializer)) {
      return (sse_decode_String(deserializer));
    } else {
      return null;
    }
  }

  @protected
  Dart2RustStreamReceiver?
  sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    if (sse_decode_bool(deserializer)) {
      return (sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
        deserializer,
      ));
    } else {
      return null;
    }
  }

  @protected
  DnsSettings?
  sse_decode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    if (sse_decode_bool(deserializer)) {
      return (sse_decode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings(
        deserializer,
      ));
    } else {
      return null;
    }
  }

  @protected
  Duration? sse_decode_opt_box_autoadd_Chrono_Duration(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    if (sse_decode_bool(deserializer)) {
      return (sse_decode_box_autoadd_Chrono_Duration(deserializer));
    } else {
      return null;
    }
  }

  @protected
  ClientCertificate? sse_decode_opt_box_autoadd_client_certificate(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    if (sse_decode_bool(deserializer)) {
      return (sse_decode_box_autoadd_client_certificate(deserializer));
    } else {
      return null;
    }
  }

  @protected
  ClientSettings? sse_decode_opt_box_autoadd_client_settings(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    if (sse_decode_bool(deserializer)) {
      return (sse_decode_box_autoadd_client_settings(deserializer));
    } else {
      return null;
    }
  }

  @protected
  CookieSettings? sse_decode_opt_box_autoadd_cookie_settings(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    if (sse_decode_bool(deserializer)) {
      return (sse_decode_box_autoadd_cookie_settings(deserializer));
    } else {
      return null;
    }
  }

  @protected
  HttpBody? sse_decode_opt_box_autoadd_http_body(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    if (sse_decode_bool(deserializer)) {
      return (sse_decode_box_autoadd_http_body(deserializer));
    } else {
      return null;
    }
  }

  @protected
  HttpHeaders? sse_decode_opt_box_autoadd_http_headers(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    if (sse_decode_bool(deserializer)) {
      return (sse_decode_box_autoadd_http_headers(deserializer));
    } else {
      return null;
    }
  }

  @protected
  ProxySettings? sse_decode_opt_box_autoadd_proxy_settings(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    if (sse_decode_bool(deserializer)) {
      return (sse_decode_box_autoadd_proxy_settings(deserializer));
    } else {
      return null;
    }
  }

  @protected
  RedirectSettings? sse_decode_opt_box_autoadd_redirect_settings(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    if (sse_decode_bool(deserializer)) {
      return (sse_decode_box_autoadd_redirect_settings(deserializer));
    } else {
      return null;
    }
  }

  @protected
  TimeoutSettings? sse_decode_opt_box_autoadd_timeout_settings(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    if (sse_decode_bool(deserializer)) {
      return (sse_decode_box_autoadd_timeout_settings(deserializer));
    } else {
      return null;
    }
  }

  @protected
  TlsSettings? sse_decode_opt_box_autoadd_tls_settings(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    if (sse_decode_bool(deserializer)) {
      return (sse_decode_box_autoadd_tls_settings(deserializer));
    } else {
      return null;
    }
  }

  @protected
  TlsVersion? sse_decode_opt_box_autoadd_tls_version(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    if (sse_decode_bool(deserializer)) {
      return (sse_decode_box_autoadd_tls_version(deserializer));
    } else {
      return null;
    }
  }

  @protected
  List<(String, String)>? sse_decode_opt_list_record_string_string(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    if (sse_decode_bool(deserializer)) {
      return (sse_decode_list_record_string_string(deserializer));
    } else {
      return null;
    }
  }

  @protected
  ProxyCondition sse_decode_proxy_condition(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var inner = sse_decode_i_32(deserializer);
    return ProxyCondition.values[inner];
  }

  @protected
  ProxySettings sse_decode_proxy_settings(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    var tag_ = sse_decode_i_32(deserializer);
    switch (tag_) {
      case 0:
        return ProxySettings_NoProxy();
      case 1:
        var var_field0 = sse_decode_list_custom_proxy(deserializer);
        return ProxySettings_CustomProxyList(var_field0);
      default:
        throw UnimplementedError('');
    }
  }

  @protected
  (Dart2RustStreamSink, Dart2RustStreamReceiver)
  sse_decode_record_auto_owned_rust_opaque_flutter_rust_bridgefor_generated_rust_auto_opaque_inner_dart_2_rust_stream_sink_auto_owned_rust_opaque_flutter_rust_bridgefor_generated_rust_auto_opaque_inner_dart_2_rust_stream_receiver(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var var_field0 =
        sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamSink(
          deserializer,
        );
    var var_field1 =
        sse_decode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
          deserializer,
        );
    return (var_field0, var_field1);
  }

  @protected
  (String, List<String>) sse_decode_record_string_list_string(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var var_field0 = sse_decode_String(deserializer);
    var var_field1 = sse_decode_list_String(deserializer);
    return (var_field0, var_field1);
  }

  @protected
  (String, MultipartItem) sse_decode_record_string_multipart_item(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var var_field0 = sse_decode_String(deserializer);
    var var_field1 = sse_decode_multipart_item(deserializer);
    return (var_field0, var_field1);
  }

  @protected
  (String, String) sse_decode_record_string_string(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var var_field0 = sse_decode_String(deserializer);
    var var_field1 = sse_decode_String(deserializer);
    return (var_field0, var_field1);
  }

  @protected
  RedirectSettings sse_decode_redirect_settings(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    var tag_ = sse_decode_i_32(deserializer);
    switch (tag_) {
      case 0:
        return RedirectSettings_NoRedirect();
      case 1:
        var var_field0 = sse_decode_i_32(deserializer);
        return RedirectSettings_LimitedRedirects(var_field0);
      default:
        throw UnimplementedError('');
    }
  }

  @protected
  RhttpError sse_decode_rhttp_error(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    var tag_ = sse_decode_i_32(deserializer);
    switch (tag_) {
      case 0:
        return RhttpError_RhttpCancelError();
      case 1:
        return RhttpError_RhttpTimeoutError();
      case 2:
        return RhttpError_RhttpRedirectError();
      case 3:
        var var_field0 = sse_decode_u_16(deserializer);
        var var_field1 = sse_decode_list_record_string_string(deserializer);
        var var_field2 = sse_decode_box_autoadd_http_response_body(
          deserializer,
        );
        return RhttpError_RhttpStatusCodeError(
          var_field0,
          var_field1,
          var_field2,
        );
      case 4:
        var var_field0 = sse_decode_String(deserializer);
        return RhttpError_RhttpInvalidCertificateError(var_field0);
      case 5:
        var var_field0 = sse_decode_String(deserializer);
        return RhttpError_RhttpConnectionError(var_field0);
      case 6:
        var var_field0 = sse_decode_String(deserializer);
        return RhttpError_RhttpUnknownError(var_field0);
      default:
        throw UnimplementedError('');
    }
  }

  @protected
  RootCertSource sse_decode_root_cert_source(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var inner = sse_decode_i_32(deserializer);
    return RootCertSource.values[inner];
  }

  @protected
  StaticDnsSettings sse_decode_static_dns_settings(
    SseDeserializer deserializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var var_overrides = sse_decode_Map_String_list_String(deserializer);
    var var_fallback = sse_decode_opt_String(deserializer);
    return StaticDnsSettings(overrides: var_overrides, fallback: var_fallback);
  }

  @protected
  TimeoutSettings sse_decode_timeout_settings(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var var_timeout = sse_decode_opt_box_autoadd_Chrono_Duration(deserializer);
    var var_connectTimeout = sse_decode_opt_box_autoadd_Chrono_Duration(
      deserializer,
    );
    var var_keepAliveTimeout = sse_decode_opt_box_autoadd_Chrono_Duration(
      deserializer,
    );
    var var_keepAlivePing = sse_decode_opt_box_autoadd_Chrono_Duration(
      deserializer,
    );
    return TimeoutSettings(
      timeout: var_timeout,
      connectTimeout: var_connectTimeout,
      keepAliveTimeout: var_keepAliveTimeout,
      keepAlivePing: var_keepAlivePing,
    );
  }

  @protected
  TlsSettings sse_decode_tls_settings(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var var_rootCertSource = sse_decode_root_cert_source(deserializer);
    var var_trustedRootCertificates = sse_decode_list_list_prim_u_8_strict(
      deserializer,
    );
    var var_verifyCertificates = sse_decode_bool(deserializer);
    var var_clientCertificate = sse_decode_opt_box_autoadd_client_certificate(
      deserializer,
    );
    var var_minTlsVersion = sse_decode_opt_box_autoadd_tls_version(
      deserializer,
    );
    var var_maxTlsVersion = sse_decode_opt_box_autoadd_tls_version(
      deserializer,
    );
    var var_sni = sse_decode_bool(deserializer);
    return TlsSettings(
      rootCertSource: var_rootCertSource,
      trustedRootCertificates: var_trustedRootCertificates,
      verifyCertificates: var_verifyCertificates,
      clientCertificate: var_clientCertificate,
      minTlsVersion: var_minTlsVersion,
      maxTlsVersion: var_maxTlsVersion,
      sni: var_sni,
    );
  }

  @protected
  TlsVersion sse_decode_tls_version(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    var inner = sse_decode_i_32(deserializer);
    return TlsVersion.values[inner];
  }

  @protected
  int sse_decode_u_16(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return deserializer.buffer.getUint16();
  }

  @protected
  int sse_decode_u_8(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return deserializer.buffer.getUint8();
  }

  @protected
  void sse_decode_unit(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
  }

  @protected
  BigInt sse_decode_usize(SseDeserializer deserializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    return deserializer.buffer.getBigUint64();
  }

  @protected
  void sse_encode_AnyhowException(
    AnyhowException self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_String(self.message, serializer);
  }

  @protected
  void
  sse_encode_AutoExplicit_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
    RequestClient self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
      self,
      serializer,
    );
  }

  @protected
  void
  sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken(
    CancellationToken self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_usize(
      (self as CancellationTokenImpl).frbInternalSseEncode(move: true),
      serializer,
    );
  }

  @protected
  void
  sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
    Dart2RustStreamReceiver self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_usize(
      (self as Dart2RustStreamReceiverImpl).frbInternalSseEncode(move: true),
      serializer,
    );
  }

  @protected
  void
  sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamSink(
    Dart2RustStreamSink self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_usize(
      (self as Dart2RustStreamSinkImpl).frbInternalSseEncode(move: true),
      serializer,
    );
  }

  @protected
  void
  sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings(
    DnsSettings self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_usize(
      (self as DnsSettingsImpl).frbInternalSseEncode(move: true),
      serializer,
    );
  }

  @protected
  void
  sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
    RequestClient self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_usize(
      (self as RequestClientImpl).frbInternalSseEncode(move: true),
      serializer,
    );
  }

  @protected
  void
  sse_encode_Auto_RefMut_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamSink(
    Dart2RustStreamSink self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_usize(
      (self as Dart2RustStreamSinkImpl).frbInternalSseEncode(move: false),
      serializer,
    );
  }

  @protected
  void
  sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken(
    CancellationToken self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_usize(
      (self as CancellationTokenImpl).frbInternalSseEncode(move: false),
      serializer,
    );
  }

  @protected
  void
  sse_encode_Auto_Ref_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
    RequestClient self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_usize(
      (self as RequestClientImpl).frbInternalSseEncode(move: false),
      serializer,
    );
  }

  @protected
  void sse_encode_Chrono_Duration(Duration self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_i_64(PlatformInt64Util.from(self.inMicroseconds), serializer);
  }

  @protected
  void
  sse_encode_DartFn_Inputs_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken_Output_unit_AnyhowException(
    FutureOr<void> Function(CancellationToken) self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_DartOpaque(
      encode_DartFn_Inputs_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken_Output_unit_AnyhowException(
        self,
      ),
      serializer,
    );
  }

  @protected
  void sse_encode_DartFn_Inputs_String_Output_list_String_AnyhowException(
    FutureOr<List<String>> Function(String) self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_DartOpaque(
      encode_DartFn_Inputs_String_Output_list_String_AnyhowException(self),
      serializer,
    );
  }

  @protected
  void sse_encode_DartFn_Inputs_http_response_Output_unit_AnyhowException(
    FutureOr<void> Function(HttpResponse) self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_DartOpaque(
      encode_DartFn_Inputs_http_response_Output_unit_AnyhowException(self),
      serializer,
    );
  }

  @protected
  void sse_encode_DartFn_Inputs_rhttp_error_Output_unit_AnyhowException(
    FutureOr<void> Function(RhttpError) self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_DartOpaque(
      encode_DartFn_Inputs_rhttp_error_Output_unit_AnyhowException(self),
      serializer,
    );
  }

  @protected
  void sse_encode_DartOpaque(Object self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_isize(
      PlatformPointerUtil.ptrToPlatformInt64(
        encodeDartOpaque(
          self,
          portManager.dartHandlerPort,
          generalizedFrbRustBinding,
        ),
      ),
      serializer,
    );
  }

  @protected
  void sse_encode_Map_String_String(
    Map<String, String> self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_list_record_string_string(
      self.entries.map((e) => (e.key, e.value)).toList(),
      serializer,
    );
  }

  @protected
  void sse_encode_Map_String_list_String(
    Map<String, List<String>> self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_list_record_string_list_string(
      self.entries.map((e) => (e.key, e.value)).toList(),
      serializer,
    );
  }

  @protected
  void
  sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerCancellationToken(
    CancellationToken self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_usize(
      (self as CancellationTokenImpl).frbInternalSseEncode(move: null),
      serializer,
    );
  }

  @protected
  void
  sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
    Dart2RustStreamReceiver self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_usize(
      (self as Dart2RustStreamReceiverImpl).frbInternalSseEncode(move: null),
      serializer,
    );
  }

  @protected
  void
  sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamSink(
    Dart2RustStreamSink self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_usize(
      (self as Dart2RustStreamSinkImpl).frbInternalSseEncode(move: null),
      serializer,
    );
  }

  @protected
  void
  sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings(
    DnsSettings self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_usize(
      (self as DnsSettingsImpl).frbInternalSseEncode(move: null),
      serializer,
    );
  }

  @protected
  void
  sse_encode_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
    RequestClient self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_usize(
      (self as RequestClientImpl).frbInternalSseEncode(move: null),
      serializer,
    );
  }

  @protected
  void sse_encode_StreamSink_list_prim_u_8_strict_Sse(
    RustStreamSink<Uint8List> self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_String(
      self.setupAndSerialize(
        codec: SseCodec(
          decodeSuccessData: sse_decode_list_prim_u_8_strict,
          decodeErrorData: sse_decode_AnyhowException,
        ),
      ),
      serializer,
    );
  }

  @protected
  void sse_encode_String(String self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_list_prim_u_8_strict(utf8.encoder.convert(self), serializer);
  }

  @protected
  void sse_encode_bool(bool self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    serializer.buffer.putUint8(self ? 1 : 0);
  }

  @protected
  void
  sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
    Dart2RustStreamReceiver self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
      self,
      serializer,
    );
  }

  @protected
  void
  sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings(
    DnsSettings self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings(
      self,
      serializer,
    );
  }

  @protected
  void sse_encode_box_autoadd_Chrono_Duration(
    Duration self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_Chrono_Duration(self, serializer);
  }

  @protected
  void sse_encode_box_autoadd_client_certificate(
    ClientCertificate self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_client_certificate(self, serializer);
  }

  @protected
  void sse_encode_box_autoadd_client_settings(
    ClientSettings self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_client_settings(self, serializer);
  }

  @protected
  void sse_encode_box_autoadd_cookie_settings(
    CookieSettings self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_cookie_settings(self, serializer);
  }

  @protected
  void sse_encode_box_autoadd_http_body(
    HttpBody self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_http_body(self, serializer);
  }

  @protected
  void sse_encode_box_autoadd_http_headers(
    HttpHeaders self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_http_headers(self, serializer);
  }

  @protected
  void sse_encode_box_autoadd_http_method(
    HttpMethod self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_http_method(self, serializer);
  }

  @protected
  void sse_encode_box_autoadd_http_response_body(
    HttpResponseBody self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_http_response_body(self, serializer);
  }

  @protected
  void sse_encode_box_autoadd_multipart_payload(
    MultipartPayload self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_multipart_payload(self, serializer);
  }

  @protected
  void sse_encode_box_autoadd_proxy_settings(
    ProxySettings self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_proxy_settings(self, serializer);
  }

  @protected
  void sse_encode_box_autoadd_redirect_settings(
    RedirectSettings self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_redirect_settings(self, serializer);
  }

  @protected
  void sse_encode_box_autoadd_static_dns_settings(
    StaticDnsSettings self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_static_dns_settings(self, serializer);
  }

  @protected
  void sse_encode_box_autoadd_timeout_settings(
    TimeoutSettings self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_timeout_settings(self, serializer);
  }

  @protected
  void sse_encode_box_autoadd_tls_settings(
    TlsSettings self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_tls_settings(self, serializer);
  }

  @protected
  void sse_encode_box_autoadd_tls_version(
    TlsVersion self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_tls_version(self, serializer);
  }

  @protected
  void sse_encode_client_certificate(
    ClientCertificate self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_list_prim_u_8_strict(self.certificate, serializer);
    sse_encode_list_prim_u_8_strict(self.privateKey, serializer);
  }

  @protected
  void sse_encode_client_settings(
    ClientSettings self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_opt_box_autoadd_cookie_settings(self.cookieSettings, serializer);
    sse_encode_http_version_pref(self.httpVersionPref, serializer);
    sse_encode_opt_box_autoadd_timeout_settings(
      self.timeoutSettings,
      serializer,
    );
    sse_encode_bool(self.throwOnStatusCode, serializer);
    sse_encode_bool(self.enableEch, serializer);
    sse_encode_bool(self.requireEch, serializer);
    sse_encode_opt_box_autoadd_proxy_settings(self.proxySettings, serializer);
    sse_encode_opt_box_autoadd_redirect_settings(
      self.redirectSettings,
      serializer,
    );
    sse_encode_opt_box_autoadd_tls_settings(self.tlsSettings, serializer);
    sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings(
      self.dnsSettings,
      serializer,
    );
    sse_encode_opt_String(self.userAgent, serializer);
  }

  @protected
  void sse_encode_cookie_settings(
    CookieSettings self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_bool(self.storeCookies, serializer);
  }

  @protected
  void sse_encode_custom_proxy(CustomProxy self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_String(self.url, serializer);
    sse_encode_proxy_condition(self.condition, serializer);
  }

  @protected
  void sse_encode_http_body(HttpBody self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    switch (self) {
      case HttpBody_Text(field0: final field0):
        sse_encode_i_32(0, serializer);
        sse_encode_String(field0, serializer);
      case HttpBody_Bytes(field0: final field0):
        sse_encode_i_32(1, serializer);
        sse_encode_list_prim_u_8_strict(field0, serializer);
      case HttpBody_BytesStream():
        sse_encode_i_32(2, serializer);
      case HttpBody_Form(field0: final field0):
        sse_encode_i_32(3, serializer);
        sse_encode_Map_String_String(field0, serializer);
      case HttpBody_Multipart(field0: final field0):
        sse_encode_i_32(4, serializer);
        sse_encode_box_autoadd_multipart_payload(field0, serializer);
    }
  }

  @protected
  void sse_encode_http_expect_body(
    HttpExpectBody self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_i_32(self.index, serializer);
  }

  @protected
  void sse_encode_http_headers(HttpHeaders self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    switch (self) {
      case HttpHeaders_Map(field0: final field0):
        sse_encode_i_32(0, serializer);
        sse_encode_Map_String_String(field0, serializer);
      case HttpHeaders_List(field0: final field0):
        sse_encode_i_32(1, serializer);
        sse_encode_list_record_string_string(field0, serializer);
    }
  }

  @protected
  void sse_encode_http_method(HttpMethod self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_String(self.method, serializer);
  }

  @protected
  void sse_encode_http_response(HttpResponse self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_opt_String(self.remoteIp, serializer);
    sse_encode_list_record_string_string(self.headers, serializer);
    sse_encode_http_version(self.version, serializer);
    sse_encode_u_16(self.statusCode, serializer);
    sse_encode_http_response_body(self.body, serializer);
  }

  @protected
  void sse_encode_http_response_body(
    HttpResponseBody self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    switch (self) {
      case HttpResponseBody_Text(field0: final field0):
        sse_encode_i_32(0, serializer);
        sse_encode_String(field0, serializer);
      case HttpResponseBody_Bytes(field0: final field0):
        sse_encode_i_32(1, serializer);
        sse_encode_list_prim_u_8_strict(field0, serializer);
      case HttpResponseBody_Stream():
        sse_encode_i_32(2, serializer);
    }
  }

  @protected
  void sse_encode_http_version(HttpVersion self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_i_32(self.index, serializer);
  }

  @protected
  void sse_encode_http_version_pref(
    HttpVersionPref self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_i_32(self.index, serializer);
  }

  @protected
  void sse_encode_i_32(int self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    serializer.buffer.putInt32(self);
  }

  @protected
  void sse_encode_i_64(PlatformInt64 self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    serializer.buffer.putPlatformInt64(self);
  }

  @protected
  void sse_encode_isize(PlatformInt64 self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    serializer.buffer.putPlatformInt64(self);
  }

  @protected
  void sse_encode_list_String(List<String> self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_i_32(self.length, serializer);
    for (final item in self) {
      sse_encode_String(item, serializer);
    }
  }

  @protected
  void sse_encode_list_custom_proxy(
    List<CustomProxy> self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_i_32(self.length, serializer);
    for (final item in self) {
      sse_encode_custom_proxy(item, serializer);
    }
  }

  @protected
  void sse_encode_list_list_prim_u_8_strict(
    List<Uint8List> self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_i_32(self.length, serializer);
    for (final item in self) {
      sse_encode_list_prim_u_8_strict(item, serializer);
    }
  }

  @protected
  void sse_encode_list_prim_u_8_loose(
    List<int> self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_i_32(self.length, serializer);
    serializer.buffer.putUint8List(
      self is Uint8List ? self : Uint8List.fromList(self),
    );
  }

  @protected
  void sse_encode_list_prim_u_8_strict(
    Uint8List self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_i_32(self.length, serializer);
    serializer.buffer.putUint8List(self);
  }

  @protected
  void sse_encode_list_record_string_list_string(
    List<(String, List<String>)> self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_i_32(self.length, serializer);
    for (final item in self) {
      sse_encode_record_string_list_string(item, serializer);
    }
  }

  @protected
  void sse_encode_list_record_string_multipart_item(
    List<(String, MultipartItem)> self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_i_32(self.length, serializer);
    for (final item in self) {
      sse_encode_record_string_multipart_item(item, serializer);
    }
  }

  @protected
  void sse_encode_list_record_string_string(
    List<(String, String)> self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_i_32(self.length, serializer);
    for (final item in self) {
      sse_encode_record_string_string(item, serializer);
    }
  }

  @protected
  void sse_encode_multipart_item(MultipartItem self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_multipart_value(self.value, serializer);
    sse_encode_opt_String(self.fileName, serializer);
    sse_encode_opt_String(self.contentType, serializer);
  }

  @protected
  void sse_encode_multipart_payload(
    MultipartPayload self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_list_record_string_multipart_item(self.parts, serializer);
  }

  @protected
  void sse_encode_multipart_value(
    MultipartValue self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    switch (self) {
      case MultipartValue_Text(field0: final field0):
        sse_encode_i_32(0, serializer);
        sse_encode_String(field0, serializer);
      case MultipartValue_Bytes(field0: final field0):
        sse_encode_i_32(1, serializer);
        sse_encode_list_prim_u_8_strict(field0, serializer);
      case MultipartValue_File(field0: final field0):
        sse_encode_i_32(2, serializer);
        sse_encode_String(field0, serializer);
    }
  }

  @protected
  void
  sse_encode_opt_AutoExplicit_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
    RequestClient? self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    sse_encode_bool(self != null, serializer);
    if (self != null) {
      sse_encode_AutoExplicit_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerRequestClient(
        self,
        serializer,
      );
    }
  }

  @protected
  void sse_encode_opt_String(String? self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    sse_encode_bool(self != null, serializer);
    if (self != null) {
      sse_encode_String(self, serializer);
    }
  }

  @protected
  void
  sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
    Dart2RustStreamReceiver? self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    sse_encode_bool(self != null, serializer);
    if (self != null) {
      sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
        self,
        serializer,
      );
    }
  }

  @protected
  void
  sse_encode_opt_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings(
    DnsSettings? self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    sse_encode_bool(self != null, serializer);
    if (self != null) {
      sse_encode_box_autoadd_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDnsSettings(
        self,
        serializer,
      );
    }
  }

  @protected
  void sse_encode_opt_box_autoadd_Chrono_Duration(
    Duration? self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    sse_encode_bool(self != null, serializer);
    if (self != null) {
      sse_encode_box_autoadd_Chrono_Duration(self, serializer);
    }
  }

  @protected
  void sse_encode_opt_box_autoadd_client_certificate(
    ClientCertificate? self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    sse_encode_bool(self != null, serializer);
    if (self != null) {
      sse_encode_box_autoadd_client_certificate(self, serializer);
    }
  }

  @protected
  void sse_encode_opt_box_autoadd_client_settings(
    ClientSettings? self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    sse_encode_bool(self != null, serializer);
    if (self != null) {
      sse_encode_box_autoadd_client_settings(self, serializer);
    }
  }

  @protected
  void sse_encode_opt_box_autoadd_cookie_settings(
    CookieSettings? self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    sse_encode_bool(self != null, serializer);
    if (self != null) {
      sse_encode_box_autoadd_cookie_settings(self, serializer);
    }
  }

  @protected
  void sse_encode_opt_box_autoadd_http_body(
    HttpBody? self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    sse_encode_bool(self != null, serializer);
    if (self != null) {
      sse_encode_box_autoadd_http_body(self, serializer);
    }
  }

  @protected
  void sse_encode_opt_box_autoadd_http_headers(
    HttpHeaders? self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    sse_encode_bool(self != null, serializer);
    if (self != null) {
      sse_encode_box_autoadd_http_headers(self, serializer);
    }
  }

  @protected
  void sse_encode_opt_box_autoadd_proxy_settings(
    ProxySettings? self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    sse_encode_bool(self != null, serializer);
    if (self != null) {
      sse_encode_box_autoadd_proxy_settings(self, serializer);
    }
  }

  @protected
  void sse_encode_opt_box_autoadd_redirect_settings(
    RedirectSettings? self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    sse_encode_bool(self != null, serializer);
    if (self != null) {
      sse_encode_box_autoadd_redirect_settings(self, serializer);
    }
  }

  @protected
  void sse_encode_opt_box_autoadd_timeout_settings(
    TimeoutSettings? self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    sse_encode_bool(self != null, serializer);
    if (self != null) {
      sse_encode_box_autoadd_timeout_settings(self, serializer);
    }
  }

  @protected
  void sse_encode_opt_box_autoadd_tls_settings(
    TlsSettings? self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    sse_encode_bool(self != null, serializer);
    if (self != null) {
      sse_encode_box_autoadd_tls_settings(self, serializer);
    }
  }

  @protected
  void sse_encode_opt_box_autoadd_tls_version(
    TlsVersion? self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    sse_encode_bool(self != null, serializer);
    if (self != null) {
      sse_encode_box_autoadd_tls_version(self, serializer);
    }
  }

  @protected
  void sse_encode_opt_list_record_string_string(
    List<(String, String)>? self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs

    sse_encode_bool(self != null, serializer);
    if (self != null) {
      sse_encode_list_record_string_string(self, serializer);
    }
  }

  @protected
  void sse_encode_proxy_condition(
    ProxyCondition self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_i_32(self.index, serializer);
  }

  @protected
  void sse_encode_proxy_settings(ProxySettings self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    switch (self) {
      case ProxySettings_NoProxy():
        sse_encode_i_32(0, serializer);
      case ProxySettings_CustomProxyList(field0: final field0):
        sse_encode_i_32(1, serializer);
        sse_encode_list_custom_proxy(field0, serializer);
    }
  }

  @protected
  void
  sse_encode_record_auto_owned_rust_opaque_flutter_rust_bridgefor_generated_rust_auto_opaque_inner_dart_2_rust_stream_sink_auto_owned_rust_opaque_flutter_rust_bridgefor_generated_rust_auto_opaque_inner_dart_2_rust_stream_receiver(
    (Dart2RustStreamSink, Dart2RustStreamReceiver) self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamSink(
      self.$1,
      serializer,
    );
    sse_encode_Auto_Owned_RustOpaque_flutter_rust_bridgefor_generatedRustAutoOpaqueInnerDart2RustStreamReceiver(
      self.$2,
      serializer,
    );
  }

  @protected
  void sse_encode_record_string_list_string(
    (String, List<String>) self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_String(self.$1, serializer);
    sse_encode_list_String(self.$2, serializer);
  }

  @protected
  void sse_encode_record_string_multipart_item(
    (String, MultipartItem) self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_String(self.$1, serializer);
    sse_encode_multipart_item(self.$2, serializer);
  }

  @protected
  void sse_encode_record_string_string(
    (String, String) self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_String(self.$1, serializer);
    sse_encode_String(self.$2, serializer);
  }

  @protected
  void sse_encode_redirect_settings(
    RedirectSettings self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    switch (self) {
      case RedirectSettings_NoRedirect():
        sse_encode_i_32(0, serializer);
      case RedirectSettings_LimitedRedirects(field0: final field0):
        sse_encode_i_32(1, serializer);
        sse_encode_i_32(field0, serializer);
    }
  }

  @protected
  void sse_encode_rhttp_error(RhttpError self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    switch (self) {
      case RhttpError_RhttpCancelError():
        sse_encode_i_32(0, serializer);
      case RhttpError_RhttpTimeoutError():
        sse_encode_i_32(1, serializer);
      case RhttpError_RhttpRedirectError():
        sse_encode_i_32(2, serializer);
      case RhttpError_RhttpStatusCodeError(
        field0: final field0,
        field1: final field1,
        field2: final field2,
      ):
        sse_encode_i_32(3, serializer);
        sse_encode_u_16(field0, serializer);
        sse_encode_list_record_string_string(field1, serializer);
        sse_encode_box_autoadd_http_response_body(field2, serializer);
      case RhttpError_RhttpInvalidCertificateError(field0: final field0):
        sse_encode_i_32(4, serializer);
        sse_encode_String(field0, serializer);
      case RhttpError_RhttpConnectionError(field0: final field0):
        sse_encode_i_32(5, serializer);
        sse_encode_String(field0, serializer);
      case RhttpError_RhttpUnknownError(field0: final field0):
        sse_encode_i_32(6, serializer);
        sse_encode_String(field0, serializer);
    }
  }

  @protected
  void sse_encode_root_cert_source(
    RootCertSource self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_i_32(self.index, serializer);
  }

  @protected
  void sse_encode_static_dns_settings(
    StaticDnsSettings self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_Map_String_list_String(self.overrides, serializer);
    sse_encode_opt_String(self.fallback, serializer);
  }

  @protected
  void sse_encode_timeout_settings(
    TimeoutSettings self,
    SseSerializer serializer,
  ) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_opt_box_autoadd_Chrono_Duration(self.timeout, serializer);
    sse_encode_opt_box_autoadd_Chrono_Duration(self.connectTimeout, serializer);
    sse_encode_opt_box_autoadd_Chrono_Duration(
      self.keepAliveTimeout,
      serializer,
    );
    sse_encode_opt_box_autoadd_Chrono_Duration(self.keepAlivePing, serializer);
  }

  @protected
  void sse_encode_tls_settings(TlsSettings self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_root_cert_source(self.rootCertSource, serializer);
    sse_encode_list_list_prim_u_8_strict(
      self.trustedRootCertificates,
      serializer,
    );
    sse_encode_bool(self.verifyCertificates, serializer);
    sse_encode_opt_box_autoadd_client_certificate(
      self.clientCertificate,
      serializer,
    );
    sse_encode_opt_box_autoadd_tls_version(self.minTlsVersion, serializer);
    sse_encode_opt_box_autoadd_tls_version(self.maxTlsVersion, serializer);
    sse_encode_bool(self.sni, serializer);
  }

  @protected
  void sse_encode_tls_version(TlsVersion self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    sse_encode_i_32(self.index, serializer);
  }

  @protected
  void sse_encode_u_16(int self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    serializer.buffer.putUint16(self);
  }

  @protected
  void sse_encode_u_8(int self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    serializer.buffer.putUint8(self);
  }

  @protected
  void sse_encode_unit(void self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
  }

  @protected
  void sse_encode_usize(BigInt self, SseSerializer serializer) {
    // Codec=Sse (Serialization based), see doc to use other codecs
    serializer.buffer.putBigUint64(self);
  }
}

@sealed
class CancellationTokenImpl extends RustOpaque implements CancellationToken {
  // Not to be used by end users
  CancellationTokenImpl.frbInternalDcoDecode(List<dynamic> wire)
    : super.frbInternalDcoDecode(wire, _kStaticData);

  // Not to be used by end users
  CancellationTokenImpl.frbInternalSseDecode(
    BigInt ptr,
    int externalSizeOnNative,
  ) : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData);

  static final _kStaticData = RustArcStaticData(
    rustArcIncrementStrongCount:
        RustLib.instance.api.rust_arc_increment_strong_count_CancellationToken,
    rustArcDecrementStrongCount:
        RustLib.instance.api.rust_arc_decrement_strong_count_CancellationToken,
    rustArcDecrementStrongCountPtr: RustLib
        .instance
        .api
        .rust_arc_decrement_strong_count_CancellationTokenPtr,
  );
}

@sealed
class Dart2RustStreamReceiverImpl extends RustOpaque
    implements Dart2RustStreamReceiver {
  // Not to be used by end users
  Dart2RustStreamReceiverImpl.frbInternalDcoDecode(List<dynamic> wire)
    : super.frbInternalDcoDecode(wire, _kStaticData);

  // Not to be used by end users
  Dart2RustStreamReceiverImpl.frbInternalSseDecode(
    BigInt ptr,
    int externalSizeOnNative,
  ) : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData);

  static final _kStaticData = RustArcStaticData(
    rustArcIncrementStrongCount: RustLib
        .instance
        .api
        .rust_arc_increment_strong_count_Dart2RustStreamReceiver,
    rustArcDecrementStrongCount: RustLib
        .instance
        .api
        .rust_arc_decrement_strong_count_Dart2RustStreamReceiver,
    rustArcDecrementStrongCountPtr: RustLib
        .instance
        .api
        .rust_arc_decrement_strong_count_Dart2RustStreamReceiverPtr,
  );
}

@sealed
class Dart2RustStreamSinkImpl extends RustOpaque
    implements Dart2RustStreamSink {
  // Not to be used by end users
  Dart2RustStreamSinkImpl.frbInternalDcoDecode(List<dynamic> wire)
    : super.frbInternalDcoDecode(wire, _kStaticData);

  // Not to be used by end users
  Dart2RustStreamSinkImpl.frbInternalSseDecode(
    BigInt ptr,
    int externalSizeOnNative,
  ) : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData);

  static final _kStaticData = RustArcStaticData(
    rustArcIncrementStrongCount: RustLib
        .instance
        .api
        .rust_arc_increment_strong_count_Dart2RustStreamSink,
    rustArcDecrementStrongCount: RustLib
        .instance
        .api
        .rust_arc_decrement_strong_count_Dart2RustStreamSink,
    rustArcDecrementStrongCountPtr: RustLib
        .instance
        .api
        .rust_arc_decrement_strong_count_Dart2RustStreamSinkPtr,
  );

  Future<void> add({required List<int> data}) => RustLib.instance.api
      .crateApiStreamDart2RustStreamSinkAdd(that: this, data: data);

  Future<void> close() =>
      RustLib.instance.api.crateApiStreamDart2RustStreamSinkClose(
        that: this,
      );
}

@sealed
class DnsSettingsImpl extends RustOpaque implements DnsSettings {
  // Not to be used by end users
  DnsSettingsImpl.frbInternalDcoDecode(List<dynamic> wire)
    : super.frbInternalDcoDecode(wire, _kStaticData);

  // Not to be used by end users
  DnsSettingsImpl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative)
    : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData);

  static final _kStaticData = RustArcStaticData(
    rustArcIncrementStrongCount:
        RustLib.instance.api.rust_arc_increment_strong_count_DnsSettings,
    rustArcDecrementStrongCount:
        RustLib.instance.api.rust_arc_decrement_strong_count_DnsSettings,
    rustArcDecrementStrongCountPtr:
        RustLib.instance.api.rust_arc_decrement_strong_count_DnsSettingsPtr,
  );
}

@sealed
class RequestClientImpl extends RustOpaque implements RequestClient {
  // Not to be used by end users
  RequestClientImpl.frbInternalDcoDecode(List<dynamic> wire)
    : super.frbInternalDcoDecode(wire, _kStaticData);

  // Not to be used by end users
  RequestClientImpl.frbInternalSseDecode(BigInt ptr, int externalSizeOnNative)
    : super.frbInternalSseDecode(ptr, externalSizeOnNative, _kStaticData);

  static final _kStaticData = RustArcStaticData(
    rustArcIncrementStrongCount:
        RustLib.instance.api.rust_arc_increment_strong_count_RequestClient,
    rustArcDecrementStrongCount:
        RustLib.instance.api.rust_arc_decrement_strong_count_RequestClient,
    rustArcDecrementStrongCountPtr:
        RustLib.instance.api.rust_arc_decrement_strong_count_RequestClientPtr,
  );
}
