via library
A comprehensive HTTP client library for Dart/Flutter applications.
This library provides a modern, type-safe HTTP client with built-in caching, logging, and response transformation capabilities. It's designed to be easy to use while providing powerful features for production applications.
Classes
- CancelToken
- Token for canceling HTTP requests.
-
Via<
R extends ViaResult> - A comprehensive HTTP client with caching, logging, and request capabilities.
- ViaAuthPipeline
- Auth token pipeline
- ViaBaseResult
- Base class for all HTTP result types in the Via library.
- ViaCachePipeline
- A pipeline that caches successful GET responses.
- ViaDebouncePipeline
- Debounce pipeline
- ViaFile
- Represents a file for multipart requests.
- ViaHelpers
- Utility class providing helper methods for HTTP operations.
- ViaLoggerPipeline
- Simple pipeline for logging request, result, and error events.
- ViaPipeline
- Abstract ViaPipeline class for request/response processing
- ViaRequest
- Represents the payload for an HTTP request.
- ViaResponseValidatorPipeline
- Response validation pipeline for business logic errors
- ViaResult
- Represents a buffered HTTP response where the entire body is in memory.
- ViaResultStream
- Represents a streaming HTTP response.
- ViaRetry
- Handles automatic request retries for failed operations.
- ViaThrottlePipeline
- Throttle pipeline
Enums
- CacheStrategy
- Caching strategy for HTTP requests.
- ViaError
- Via exception types
- ViaMethod
Mixins
-
ViaMethods<
R extends ViaResult> - A mixin that provides shorthand methods for common HTTP operations.
Typedefs
-
ExecutorMethod
= Future<
ViaBaseResult> Function(ViaRequest request) - Type alias for the method function that executes HTTP requests
-
ResponseValidator
= FutureOr<
String?> Function(ViaBaseResult result) - Type alias for response validator function
-
Runner
= Future<
ViaBaseResult> Function(ExecutorMethod method, ViaRequest request) - Type alias for custom runner (e.g., isolate execution)
-
ViaHeaders
= Map<
String, String> - Type alias for HTTP headers map
Exceptions / Errors
- SkipRequest
- Thrown to skip the HTTP request and return a cached/mock response
- ViaException
- Exception thrown by Via during request or response processing.