retrofit_generator 10.2.0
retrofit_generator: ^10.2.0 copied to clipboard
retrofit generator is an dio client generator using source_gen and inspired by Chopper and Retrofit.
10.2.0 #
- Extend analyzer dependency range to support analyzer 9.0.0 ('>=7.7.1 <10.0.0')
- Note: Full analyzer 9.0.0 API migration is pending. For now, the package declares compatibility but may require dependency_overrides to resolve to analyzer 8.x until all dependencies are updated
- Add Response parameter to logError response data parsing callback
10.1.0 #
- Add lean_builder as a dependency to support experimental lean_builder integration
- Fix package validation errors for lean_builder imports
- Prepare infrastructure for optional lean_builder support
10.0.10 #
- Fix null check operator error when using Object type as @Body parameter by @Copilot in #814
- Fix duplicate null check for nullable optional File parameters in multipart requests by @Copilot in #813
- Fix List code generation to avoid incorrect Map casting by @Copilot in #811
- Add support for global headers in @RESTapi annotation by @Copilot in #812
- Fix @part annotation generating wrong variable reference for MultipartFile by @Copilot in #824
- Fix nullable typed Map parameters in @Body() annotation by @Copilot in #823
- Add test coverage for enum arrays in @part annotations by @Copilot in #822
- Fix Map value deserialization for generic types with type parameters by @Copilot in #825
10.0.8 (Unreleased) #
- Add experimental lean_builder support infrastructure
- Add
lib/lean_builder.dartentry point for lean_builder users - Add comprehensive documentation for lean_builder support
- Note: lean_builder is now an optional dependency - it's not required unless you want to use lean_builder
- Note: Full lean_builder implementation is pending until lean_builder reaches stability
10.0.6 #
- Update
protobufto 5.0.0
10.0.5 #
- Allow build 4.0.0.
10.0.3 #
- Require source_gen: 3.1.0, stop using deprecated
TypeChecker.fromRuntimeand use the newTypeChecker.typeNamedinstead.
10.0.2 #
- Format generated code with default DartFormatter
- Add
dart format offanddart format oncomments to generated code
10.0.1 #
- Fix dependencies versions
10.0.0 #
- Migrate to
Element2 - Updates minimum supported SDK version to Dart 3.8
9.7.0 #
- Upgrade build_runner to 2.5.4
9.6.0 #
- Updates minimum supported SDK version to Dart 3.6
9.5.0 #
- Migrate enum value name resolve from
.nameto.toString().nameis pretty limited to in terms of adjusting the value. Having resolve through.toString()gives you high level of flexibility on changing the resulting request value. Another improvement that this fix synchronizes the way of resolving values for individual enum values and for the list of entities. Previously individual values where resolved through.nameand list of enums via.toStringdeeper insidedioclient
9.3.0 #
-
Added
@BodyExtraannotation: Add individual fields to request body without defining complete DTO classes- Support for adding dynamic fields to existing request bodies
expandparameter (default: false) to control object field flattening behavior
Example(Combine fields):
@http.POST('/path/') Future<String> updateValue(@BodyExtra('id') int id, @BodyExtra('value') String value);Request body result:
{"id": 123, "value": "some value"}Example(Combine objects):
// pseudocode class User { int userId; String userName; } class Settings { int a; int b; } @http.POST('/path/') Future<String> updateValue( @BodyExtra('user', expand: true) User user, @BodyExtra('settings', expand: true) Settings settings, );Request body result:
{"userId": 123, "userName": "hhh", "a": 1, "b": 2}
9.2.0 #
- Update protobuf version to 4.0.0
9.1.9 #
-
Fixed issue with
@Partannotation with toJson() enum values.Example:
import 'package:json_annotation/json_annotation.dart'; @JsonEnum() enum TestEnumWithToJson { @JsonValue('A') A('A'), @JsonValue('B') B('B'); const TestEnumWithToJson(this.json); final String? json; String? toJson() => json; } @RestApi() abstract class TestModelList { @POST('/') Future<void> testEnumWithToJsonType(@Part() TestEnumWithToJson enumValue); }
9.1.8 #
-
Fixed bug of callAdapter using yield/return incorrectly
-
Fixed issue which generated invalid code for the same path parameter appears multiple times.
Example:
@GET('/image/{imageType}/{id}/{id}_XL.png') Future<HttpResponse<dynamic>> getImage( @Path('imageType') ImageType imageType, @Path('id') String id, );
9.1.7 #
-
Introduced CallAdapters, This feature allows adaptation of a Call with return type R into the type of T. e.g. Future
Code Example:
class MyCallAdapter<T> extends CallAdapter<Future<T>, Future<Either<ApiError, T>>> {
@override
Future<Either<ApiError, T>> adapt(Future<T> Function() call) async {
try {
final response = await call();
return Either.right(response);
}
catch (e) {
return Either.left(ApiError(e));
}
}
}
@RestApi()
abstract class RestClient {
factory RestClient(Dio dio, {String? baseUrl}) = _RestClient;
@UseCallAdapter(MyCallAdapter)
@GET('/')
Future<Either<ApiError, User>> getTasks();
}
9.1.6 #
- Update
analyzer,dart_styleandsource_gendependencies to allow upper versions
9.1.5 #
-
Add support for nested object of non-primitive types in
TypedExtras.Example :
@RestApi() abstract class TypedExtrasTest { @DummyTypedExtras( id: '1234', config: Config( date: '24-10-2024', type: 'analytics', shouldReplace: true, subConfig: {'date': '24-11-2025'}, ), ) @GET('path') Future<void> list(); }
9.1.3 #
-
Add support for multiple
TypedExtras.Example :
@TypedExtrasSubClass( id: 'abcd', fileType: FileType.json, destinations: [Destination.remote] ) @AnotherTypedExtrasSubClass( state: 'Ohio', destinations: [Destination.remote] ) @http.POST('/path/') Future<String> myMethod();
9.1.2 #
-
Support passing Enums into
TypedExtras.Example :
@TypedExtrasSubClass( id: 'abcd', fileType: FileType.json, destinations: [Destination.remote] ) @http.POST('/path/') Future<String> myMethod();
9.1.0 #
-
Added
@TypedExtrasto pass extra options to dio requests using custom annotations.Example :
@TypedExtrasSubClass( id: 'abcd', count: 5, shouldProceed: true, ) @http.POST('/path/') Future<String> myMethod(@Extras() Map<String, dynamic> extras);
9.0.0 #
- Require Dart 3.3
- Fix issue with deprecated
getDisplayString(withNullability: true) - Update
analyzer: ^6.5.0 - Update
lints: ^4.0.0and fix issues - Remove
tupledependency
8.1.0 #
-
Added
@Extrasto pass extra options to dio requests, response, transformer and interceptors.Example :
@http.POST('/path/') Future<String> myMethod(@Extras() Map<String, dynamic> extras);
8.0.6 #
- @useResult
8.0.5 #
-
fix #627 where generic argument constructors on any class not directly marked with
@JsonSerializable(genericArgumentFactories: true) -
fix some typos in this changelog.
8.0.2 #
- fix #630 Null check operator used on a null value
8.0.1 #
- Add option class-name to customize the name of retrofit generator
8.0.0 #
- Add protobuf support
- Add PreventNullToAbsent annotation to allow null sent to server
7.0.8 #
- Use
toJson()instead of.nameif enums havetoJson().
7.0.7 #
- Enums return types generated iterating over the enum values instead of calling
.toJson()method - Enums as query parameters generated with
.nameinstead oftoJson()
7.0.6 #
- Fix DateTime.toIso8601String() issue #586
7.0.3 #
- Add support for analyzer 6.0.0
7.0.2 #
- Fixed generation of
DateTimeused as@Queryparameters (now it is converted toStringusingtoIso8601String)
7.0.1 #
- Rename
retrofittoretrofit_generatorin build.yaml fix for build_runner ^2.4.4 - Add topics
7.0.0 #
- Fix deprecated warnings with analyzer 5.12.0
- [BREAKING CHANGE] Require Dart >= 2.19 for new analyzer
6.0.0 #
- [BREAKING CHANGE] Update min Dart sdk to 2.18
- Update example
- Fix link in readme
5.0.0+1 #
- Support multi parameter types for headers
- Make data null when it is empty
5.0.0 #
- Update dio to ^5.0.0
4.1.2 #
- add recommended dart lints to project
4.1.1 #
- fix error with code_builder version above 4.3.x
4.1.0+1 #
- use dart doc instead of dartdoc
4.1.0 #
- [BREAKING CHANGE] update analyzer to 4.7.x and Dart version to 2.17
4.0.3 #
- fix null compatibility
4.0.1 #
- fix: Code generation will fail if you use the DioResponseType annotation. #452
4.0.0 #
- [BREAKING CHANGE] update analyzer to 3.x and dart to 2.14
3.0.1 #
- Generate code for Multipart mime-type
3.0.0 #
- Support
Parser.FlutterComputefor generating data on separate isolates (#408)
2.2.0 #
- rollback to dio from dip_http
2.1.0 #
-
replace dio by dio_http
-
fix generic use toJson method in Post @Body
-
nullable list of int was added to generator
2.0.1 #
- add CacheControl
2.0.0-beta3 #
- Fixed CancelRequest generating invalid code (#322)
- Fixed onSendProgress generating invalid code (#325)
2.0.0-beta2 #
- Update to dio-prev3
- Update to source_gen 1.0.0
2.0.0-beta1 #
- Null safety support
1.4.1 #
- Add support for json serializable generic types
1.4.0 #
- compatible with analyzer 0.40.0
1.3.8 #
- Send list params duplication in multipart
1.3.7 #
- Add support for abstract classes with
toJsondefined in mixin/interface/superclass. This approach is used in freezed package
1.3.6 #
- Add support of Stream return type.
1.3.5 #
- Add multiple
@Queriesdecorators support - Add serializable objects with
@Queriesdecorator support
1.3.4 #
- Add dart json mapper deserialize support
1.3.3 #
- Add content type support to
Part
1.3.1+4 #
- add workaround for [#143]
1.3.0+1 #
- Add support to post file as request body
1.3.0 #
- Bumped retrofit_generator's SDK requirement to >=2.6.0
1.2.3 #
- remove query parameter which is null
1.2.2 #
- stringify models in FormData #111
1.2.1 #
- Add
List<File>support
1.2.0 #
- Add
HttpResponseto handle the original response
1.1.0 #
- fix
FormUrlEncodedissue
1.0.2 #
- Add
baseUrlas a parameter ofRestClient's conductor - Add base test for task api
1.0.1 #
- Add dio response type support
1.0.0 #
- Support dio 3.0
0.6.3+1 #
- Fix #53, Pin version of
dioto2.1.16
0.6.3 #
- [BREAKING CHANGE] Requires
retrofit: ^0.6.3 - Respect user option
autoCastResponse(this will skip.fromJson) - Allow custom classes without
.toJsonmethod (generator will throw warning)
0.6.2 #
- fix: fix bad cast exception (#47)
- add CancelToken, SendProgress, and ReceiveProgress (#46)
0.6.0 #
- [BREAKING CHANGE] only works dart 2.2.2 and above
- Added support to multiple clients with different base urls.
0.5.0 #
0.4.3 #
- Minor fix
0.4.2 #
- Added support to generate strong mode compatible source code
0.4.1 #
- Added generic auto casting for
Map<String, List<Model>>orMap<String, Model>
0.4.0 #
Added bean class support for @Body() annotation.
Here's the example.
Future<String> createUser(@Body() User user);
class User {
Map<String, dynamic> toJson() => {};
}
please notice that: You have to provide a
toJson()method to the bean classes to return aMap<String, dynamic>.
0.3.0 #
Added support for generic serialization.
Please note:
It doesn't support nested generics.
0.2.3 #
- Added support for
Fileform fields. See example inretrofit.dartreadme.
0.2.2 #
- bump to 0.2.2
0.2.1 #
- Fixed pub upload issue
0.2.0 #
-
Added
@Extrato pass extra options to dio requests, response, transformer and interceptors.Example :
@http.POST('/path/') @dio.Extra({'my_key':'my_value'}) Future<String> myMethod(); -
Fixed general dart style and code conventions
-
Automatically
nullcheck withArgumentError.checkNotNullfor required parameters -
Now SuperClasses can use forwarding/redirecting constructors instead of static
instance()methodExample :
@RestApi(baseUrl: "https://httpbin.org/") abstract class RestClient { /// Forwarding constructor factory RestClient([Dio dio]) = _RestClient; }
0.1.0 #
- fix health issues
0.0.1 #
- init