falkon library
Falkon — a lean, interceptor-driven HTTP client for Dart.
Import this single file to access the full public API:
import 'package:falkon/falkon.dart';
Classes
- BearerTokenInterceptor
-
Adds a static
Authorizationheader to every outgoing request. - ErrorHandler
- Thin wrapper passed to Interceptor.onError.
-
Failure<
T> - The unhappy path. Carries a structured NetworkException.
- FalkonClient
-
Concrete implementation of NetworkClient backed by
dart:io's HttpClient anddart:convert's JSON codec. - FalkonClientConfig
- Immutable configuration snapshot for FalkonClient.
- Interceptor
- Contract every interceptor must implement.
- LoggingInterceptor
- Pretty-prints requests and responses to stdout.
- NetworkClient
- The pristine abstraction for standard REST API communication. It is lean, highly cohesive, and incredibly easy to mock.
- NetworkRepository
- Marker base type for your feature repositories.
- NetworkService
- Base class for higher-level domain services wrapping a NetworkClient.
- NetworkTransferClient
- Dedicated abstraction for large file operations. Keeps the core NetworkClient from becoming a God Object.
- RequestContext
- Snapshot of a request at the moment it enters the interceptor chain.
- RequestHandler
- Thin wrapper passed to Interceptor.onRequest so the interceptor can either mutate & proceed or short-circuit with a synthetic result.
- RequestOptions
- Per-request configuration that overrides client-level defaults.
- ResponseContext
- Snapshot of a response before it reaches the caller.
- ResponseHandler
- Thin wrapper passed to Interceptor.onResponse.
-
Result<
T> -
Sealed discriminated union for success / failure without exceptions escaping
the network layer. Inspired by Rust's
Result<T, E>. - RetryInterceptor
- Retries failed requests up to maxAttempts times with exponential back-off.
-
Success<
T> - The happy path. Carries the parsed response body.
- UploadFile
- A single file entry for multipart upload.
Enums
- HttpMethod
- Strongly-typed HTTP verbs. Keeps raw strings out of call-sites.
Typedefs
-
JsonParser<
T> = T Function(Map< String, dynamic> json) - A function signature for parsing raw JSON maps into strongly-typed models.
- ProgressCallback = void Function(int sent, int total)
- Reports bytes transferred during an upload or download.
Exceptions / Errors
- ConnectionException
- No network connectivity or DNS lookup failed.
- HttpStatusException
- Server responded, but with a non-2xx status code.
- NetworkException
- Root of all network-layer errors.
- ParseException
- The JSON body could not be decoded into the expected shape.
- TimeoutException
- The request exceeded its deadline.
- UnknownNetworkException
- Anything else that doesn't fit above.