via 1.6.0
via: ^1.6.0 copied to clipboard
A modern, type-safe HTTP client library for Dart/Flutter applications.
Changelog #
All notable changes to this project will be documented in this file.
1.6.0 #
Changed #
- BREAKING: Renamed
maxAttemptstomaxRetriesinViaRetry. Now0means no retries (clearer semantics). - BREAKING: Renamed
onStreamtoonResultStreaminViaPipelinefor consistency withonResult.
Fixed #
- Debounce Cleanup: Fixed potential memory leak in
ViaDebouncePipelinewhen requests fail or throw exceptions.
Docs #
- Added warning about retry not working with streaming request bodies (
Stream<List<int>>).
1.5.5 #
Changed #
- Pipeline Architecture: Refactored
ViaPipelinefor better type safety and clarity.onResultnow specifically handlesViaResult(buffered responses).onStreamnow receives the fullViaResultStreamobject instead of raw stream chunks, allowing access to response metadata (headers, status code) during streaming.
- Enhanced Streaming: Added
ViaResultStream.copyWithto allow pipelines to transform response streams while preserving metadata. - Improved Validation:
ViaResponseValidatorPipelinenow supports validation of both buffered and streaming responses.
1.5.4 #
Fixed #
- Map Body Casting: Fixed an issue where
Mappayloads with non-string values (likeintorbool) would cause a type cast error. They are now automatically converted to strings for form-data requests.
Changed #
- Modernized Syntax: Fully adopted Modern Dart enum member access (e.g.,
.networkinstead ofViaError.network). - Simplified Examples: Consolidated multiple example files into a single, clean
example/main.dart. - Unit Tests: Added a comprehensive suite of unit tests with real network request validation.
1.5.3 #
Fixed #
- Pipeline Error Handling: Fixed an issue where
onErrorwas not being called on pipelines when a request failed. - Logger Stream Support: Added stream error tracking to
ViaLoggerPipelineviaonStreaminterception.
1.5.2 #
Changed #
- Architecture Refinement: Simplified internal request handling by returning
ViaBaseResultfromworkerand handling type casting inViaMethods. This provides better flexibility for custom result types (likeSotyResult) used with pipelines.
1.5.1 #
Fixed #
- Type Safety: Fixed a critical
type 'ViaResult' is not a subtype of type 'R' in type casterror inViaMethods. BothVia.workerandViaMethods._requestare now generic to correctly handle custom result types.
1.5.0 #
Changed #
- Simplified API: Removed
ViaExecutorclass. All execution logic (pipelines, retry, runner) has been moved directly into theViaclass for a cleaner and more intuitive API. - Truly Pure Dart: Removed the
flutterSDK dependency. The library is now a pure Dart package, compatible with CLI, Server-side, and Flutter. - HTTP Focus: Removed internal WebSocket support to keep the library lightweight and focused on HTTP.
- Auto-mapping Support: Added
to<T>andtoListOf<T>methods toViaResultfor seamless JSON-to-Model conversion. - Stream Body Support: Enhanced
Viato supportStream<List<int>>as a request body. - Dedicated Streaming API: Introduced
via.stream()method which returnsFuture<ViaResultStream>. This allows accessing status codes and headers before consuming the response stream. - Internal Refactoring: Organized source files into a flatter, more logical structure.
Fixed #
- Isolate Stability: Explicitly detaching the request object from the response before returning from an isolate. This prevents "Illegal argument in isolate message" errors caused by unsendable
ByteStreamreferences inMultipartRequest. - Auto Isolate Bypass: Added automatic Isolate bypass for requests containing
Streambodies orCancelTokens.
Changed #
- API Simplification: Removed
ViaCallwrapper. Standard HTTP methods now returnFuture<ViaResult>directly. - Dedicated Streaming API: Introduced
via.stream()method which returnsFuture<ViaResultStream>. This allows accessing status codes and headers before consuming the response stream.
1.4.1 #
Added #
- Fluent API with ViaCall: Introduced
ViaCallwhich implementsFuture, allowing directawait via.get()while providing a.streamgetter for byte streaming. - Streaming Response Support: Added real-time byte streaming with
.streamgetter on any request. - Improved Result Buffering:
ViaResultnow handles lazy buffering, allowing both streaming and future-based body access on the same result. - Pipeline onStream Support: Added
onStreamhook toViaPipelinefor intercepting or transforming data chunks in real-time without blocking the stream. - New Example: Added
example/stream_response.dartto demonstrate the new streaming capabilities.
Changed #
- Modern Dart Syntax: Adopted modern Dart enum member access (e.g.,
.getinstead ofViaMethod.get). - Isolate Safety: Refactored
ViaResultto be isolate-friendly by lazily initializing non-sendable fields likeCompleter. - API Cleanup: Removed redundant
isStreamflags and explicitvia.stream()methods in favor of the more intuitive.streamgetter on any call.
1.3.0 #
Added #
- Multipart Upload Support: Dedicated
via.multipart()method for form-data and file uploads. - WebSocket Support: Introduced
ViaSocketfor lightweight and flexible WebSocket connections. - WebSocket Pipelines: Added
ViaSocketPipelinefor intercepting lifecycle events. - WebSocket Auto-Reconnect: Support for
autoReconnectandreconnectDelay. - Smart URI Conversion: Automatic
http/httpstows/wssconversion. - Examples: Added
multipart_example.dart.
Changed #
- API Simplification: Shorthand methods (
post,put,patch,delete) now only handle standard bodies. All file uploads must usevia.multipart(). - Internal Refactoring: Moved HTTP methods to
ViaMethodsmixin and organized pipelines intosrc/features/pipelines/. - Removed
part/part ofstructure in favor of standard imports.
1.2.4 #
Changed #
- Refactored HTTP methods to use the
ViaMethodenum for better type safety and consistency. - Updated
ViaRequest.toCurl()andViaRequest.toString()to correctly use enum values. - Internal cleanup of method parameter types across the library.
1.2.3 #
Changed #
- Internal cleanup: Removed redundant generic type parameters from
ViaExecutorandViaRetry. - Simplified internal execution flow by centralizing type casting in the
Viaclass. - Improved code maintainability by reducing generic boilerplate in core feature classes.
- Updated all examples to support sequential execution via
Future<void> main(). - Improved
example/main.dartto act as a comprehensive test runner for all features. - Enhanced
example/pipeline.dartwith a custom logger for better visibility.
1.2.2 #
Fixed #
- Further improved
toCurlcharacter escaping by using single quotes for headers and URL to prevent shell interpretation issues. - Fixed
toJsoninViaResultto correctly handle null-aware response properties. - Added
responseobject toViaExceptioninViaResponseValidatorPipelinefor better debugging.
1.2.1 #
Fixed #
- Fixed
toJsonandtoCurlimplementations inViaRequest. - Improved cURL command generation with better character escaping for terminal compatibility.
- Fixed
ViaExceptionJSON serialization by correcting null-aware syntax. - Adopted modern Dart null-aware map entries syntax (
?variable) for cleaner metadata.
1.2.0 #
Changed #
- Refactored
ViaPipelineto be non-generic for better flexibility and simplicity. - Removed generic requirements from all built-in pipelines (
ViaLoggerPipeline,ViaCachePipeline, etc.). - Simplified custom result transformation by removing
covariantcomplexity in favor of standard inheritance.
1.1.0 #
1.0.0 #
Added #
- Initial release of the Via HTTP engine.
Viaclass for high-level HTTP operations.ViaExecutorwith support forViaPipelinearchitecture.- Built-in resilience with
ViaRetry(automatic retries). - Request cancellation support via
CancelToken. - Type-safe JSON parsing helpers (
asMap,asList). - Memory-managed
ViaCachePipeline(FIFO withmaxEntries). - Advanced pipelines:
ViaLoggerPipeline(with cURL support),ViaDebouncePipeline,ViaThrottlePipeline, andViaResponseValidatorPipeline. - Connection pooling support with shared
http.Client. - Isolate-based execution support for background processing.
errorIfvalidation inViaExecutorto treat HTTP responses as errors (defaults to non-2xx).