FalkonClient class

Concrete implementation of NetworkClient backed by dart:io's HttpClient and dart:convert's JSON codec.

Quick start

final client = FalkonClient(
  FalkonClientConfig.builder('https://api.example.com')
    .timeout(const Duration(seconds: 15))
    .addInterceptor(LoggingInterceptor())
    .addInterceptor(BearerTokenInterceptor(() => authService.token))
    .maxRetries(2)
    .build(),
);
Implemented types

Constructors

FalkonClient(FalkonClientConfig config)

Properties

hashCode int
The hash code for this object.
no setterinherited
interceptors List<Interceptor>
Manage interceptors (Auth, Logging, etc.)
no setteroverride
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addInterceptor(Interceptor interceptor) → void
override
close({bool force = false}) → void
Release the underlying HttpClient. Call when done with this instance.
delete<T>(String path, {Object? body, Map<String, dynamic>? query, JsonParser<T>? parser, RequestOptions? options}) Future<Result<T>>
override
download(String url, {required String savePath, ProgressCallback? onProgress, RequestOptions? options}) Future<Result<File>>
Standard one-shot file download.
override
get<T>(String path, {Map<String, dynamic>? query, JsonParser<T>? parser, RequestOptions? options}) Future<Result<T>>
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
patch<T>(String path, {Object? body, Map<String, dynamic>? query, JsonParser<T>? parser, RequestOptions? options}) Future<Result<T>>
override
post<T>(String path, {Object? body, Map<String, dynamic>? query, JsonParser<T>? parser, RequestOptions? options}) Future<Result<T>>
override
put<T>(String path, {Object? body, Map<String, dynamic>? query, JsonParser<T>? parser, RequestOptions? options}) Future<Result<T>>
override
request<T>(String path, {required HttpMethod method, Object? body, Map<String, dynamic>? queryParameters, JsonParser<T>? parser, RequestOptions? options}) Future<Result<T>>
Sends a generic HTTP request. Core verbs delegate to this method.
override
toString() String
A string representation of this object.
inherited
upload<T>(String path, {required List<UploadFile> files, Map<String, String>? fields, JsonParser<T>? parser, ProgressCallback? onProgress, RequestOptions? options}) Future<Result<T>>
Handles large multipart file uploads with progress tracking.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited