service_client 0.2.0
service_client: ^0.2.0 copied to clipboard
A service client abstraction for Dart with the Result pattern. Includes an HTTP implementation.
Changelog #
All notable changes to this project will be documented in this file.
The format loosely follows Keep a Changelog and the project adheres to Semantic Versioning.
0.2.0 - 2026-03-16 #
Added #
Result<S, F>sealed class withSuccessandFailuresubtypes for explicit success/failure handling with compile-time exhaustive pattern matchingServiceFailurebase class for typed HTTP errors (extensible by consumers)- Example updated to MVC pattern: View (
main) → Controller (TodoController) → Service (JsonPlaceholderService) →Result
Removed (Breaking) #
Token— in-memory session managerTokenVault— refresh token persistence facadeAuthReLoginException— re-authentication exceptionTokenStorageAdapter,TokenStorageException— storage interfaceMemoryStorageAdapter— in-memory token storageFileStorageAdapter,AesGcmEncryptor,TokenEncryptor,PassphraseProvider— encrypted file storageauthparameter fromServiceClientConfigandhttpClient()functioncryptographydependency
Migration from 0.1.x #
- Remove all references to
Token,TokenVault,AuthReLoginException, and storage adapters - Remove the
authparameter fromServiceClientConfigandhttpClient()calls - Use
Result<S, F>pattern to handle service responses instead of try/catch
0.1.2 - 2026-03-05 #
Fixed #
- Replaced
dart:io(stderr) withdart:developer(log) inhttp_client.dartandhttp_service_client.dartfor Flutter web compatibility
0.1.1 - 2026-01-05 #
Added #
HttpClientExceptionfor handling general HTTP client errors- Request logging for debugging HTTP requests
- Response logging for debugging HTTP responses
- Exception logging for better error tracking
0.1.0 - 2025-12-09 #
Added #
- Initial release of service_client. Main features:
- Flexible HTTP client interface (
HttpServiceClient) - Service configuration with support for base URL, headers, and timeout settings
- Token-based authentication support
- Multiple token storage adapters:
- Memory storage adapter for in-memory token caching
- File storage adapter for persistent token storage
- Service request/response handling
- Exception handling for authentication errors
- Example implementation using JSONPlaceholder API
- Flexible HTTP client interface (