rest_client_builder 1.2.2
rest_client_builder: ^1.2.2 copied to clipboard
A Clean Architecture code-generation framework for building typed REST API clients in Dart and Flutter using annotations and build_runner.
Changelog #
All notable changes to this project will be documented in this file.
This project adheres to Semantic Versioning.
1.2.1 #
- Refactored Code Generation: The builder now generates standalone
.g.dartfiles, completely removing the need forpartfiles. - Zero-Boilerplate Models: Removed the requirement to manually define
fromJson/toJsonmappings inside your@RestModel()classes. - Smart Imports: API generation automatically detects dependencies and imports the necessary source and generated files.
- Static Analysis & Dependencies: Updated
analyzer,dio, and other constraints. Addressed all static analysis warnings and documentation issues to achieve a perfect pub.dev score.
1.2.0 #
Initial stable release.
Added #
@RestApiannotation-driven REST client code generation viabuild_runner.@RestModelJSON code generation (fromJson/toJson) with fullJsonKeysupport.RestResult<T>sealed success/failure type withwhen,fold,map,flatMap,mapAsync,flatMapAsync,getOrThrow, andgetOrElse.RestErrortransport-agnostic structured error with factory constructors:unknown,validation,timeout,cancelled,connection,http, andserialization.DioRestClientwith retry, timeouts, header merging, logging, and interceptor resolution.RestPart.fromBytes/RestPart.fromBase64for web-safe multipart uploads (nodart:io).BasicCancelTokenfor cooperative cancellation withisCancelled/whenCancelled.RestProgressCallbackfor upload and download progress.@UseInterceptor/@ExcludeInterceptorper class or method.@Retry,@ConnectTimeout,@ReceiveTimeout,@SendTimeout,@EnableLogoverrides at the global, API, and endpoint levels.- Compile-time validation: duplicate routes, GET/HEAD + body, missing
@Path, invalid multipart combinations, and invalid return types. RestApiGlobalConfigurationcontract withcreateRestClient()factory (shared singleton) andcreateFreshRestClient()(isolated, for tests).RestApiClientRegistryfor shared Dio connection-pool reuse.CallbackRestClientfor easy unit testing without a network layer.DefaultInterceptorPipelinewith forward-request / reverse-response / reverse-error order.LoggingRestInterceptorwith sensitive-header redaction (Authorization,Cookie, etc.).- Generated
ApiDocs.endpointslist and dartdoc tables in every*.rest.g.dartfile. build.yamlbuilder registration — no consumerbuild.yamlrequired.- Full CRUD + multipart example under
example/. - 7 test suites covering core, runtime, validators, generator, and REST parts.