RhttpClient.createSync constructor

RhttpClient.createSync({
  1. ClientSettings? settings,
  2. List<Interceptor>? interceptors,
})

Creates a new HTTP client synchronously. Use this method if your app is starting up to simplify the code that might arise by using async/await.

Note: This method crashes when configured to use HTTP/3. See: https://github.com/Tienisto/rhttp/issues/10

Implementation

factory RhttpClient.createSync({
  ClientSettings? settings,
  List<Interceptor>? interceptors,
}) {
  settings ??= const ClientSettings();
  final ref = rust.registerClientSync(
    settings: settings.toRustType(),
  );
  return RhttpClient._(
    settings: settings,
    interceptor: parseInterceptorList(interceptors),
    ref: ref,
  );
}