retrofit_generator
retrofit generator is an dio client generator using source_gen and inspired by Chopper and Retrofit.
10.2.9
414K downloads/mo
#574 most downloaded on pub.dev
trevorwang/retrofit.dart
What this package is like to depend on
Last release 5 days ago
19 Aug 2026
Ships fairly regularly
a new release about every 4 weeks
Some releases are documented
notes for 88 of 161 stable releases
2 versions withdrawn
withdrawn after publishing
7 years old
166 releases · first in 2019
17 releases in the last 12 months
see the full history below
Release timeline
166 releases · Apr 2019 to Aug 2026Releases
latest 60 of 166-
10.2.919 Aug 2026Release notes
Open source →fix(generator): use utf8.decoder.bind for string streams to prevent m…
…alformed chunk exceptions (#931)
-
10.2.821 Jul 2026Release notes
Open source →fix: keep the request future in the stream pipeline for ResponseType.…
…stream (#921)
Closes #907. Generated methods for @DioResponseType(ResponseType.stream) awaited
the request future inside an async* body, so if the subscription was cancelled
while suspended at the await, a later error from that future could escape the
stream listener lifecycle and surface as an unhandled zone error. Emit
_dio.fetch<ResponseBody>(...) without await and expand it through
asStream().asyncExpand(...) instead, keeping the future inside the stream. -
10.2.716 Jun 2026Release notes
Open source →Fix map value deserialization for generic type-parameter models in ge…
…nerator output (#916)
* Initial plan
* fix(generator): handle type parameters in map generic value deserialization
Agent-Logs-Url: https://github.com/trevorwang/retrofit.dart/sessions/e48c0b86-23bc-473a-89ba-a5a699fabd2a
Co-authored-by: trevorwang <[email protected]>
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: trevorwang <[email protected]> -
10.2.608 May 2026Release notes
Open source →What's Changed
- chore: add avoid_redundant_argument_values to analyzer ignores by @gktirkha in #913
- Allow
analyzer13.0.0 by @Carapacik in #912 - Use toString() for multipart enum values by @kyungilcho in #896
New Contributors
- @gktirkha made their first contribution in #913
- @kyungilcho made their first contribution in #896
Full Changelog: v10.2.5...v10.2.6
-
10.2.510 Apr 2026Nothing published for this version
-
10.2.407 Apr 2026Release notes
Open source →What's Changed
- Allow new analyzer and temp delete lean_builder form dependencies by @Carapacik in #897
- build(deps-dev): bump js-yaml from 4.1.0 to 4.1.1 by @dependabot[bot] in #853
- build(deps-dev): bump lodash from 4.17.21 to 4.17.23 by @dependabot[bot] in #888
- Release retrofit 4.9.1: Fix ParseErrorLogger signature for backward compatibility by @Copilot in #883
- Fix: add warning for missing dart:convert import when using ResponseType.stream by @japanshah17 in #905
New Contributors
- @japanshah17 made their first contribution in #905
Full Changelog: v10.2.3...v10.2.4
-
10.2.310 Feb 2026Release notes
Open source →Document analyzer 9.x compatibility fix in CHANGELOG (#875)
* Initial plan
* Update CHANGELOG to document analyzer 9.0.0 compatibility fix
Co-authored-by: trevorwang <[email protected]>
* Clarify analyzer 9.x compatibility in CHANGELOG (supports all 9.x versions)
Co-authored-by: trevorwang <[email protected]>
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: trevorwang <[email protected]>
Co-authored-by: Trevor Wang <[email protected]> -
10.2.120 Dec 2025Release notes
Open source →- Fix analyzer 9.x compatibility: Remove deprecated Element2 API usage that caused build failures with analyzer 9.0+
- Support analyzer
'>=8.0.0 <10.0.0'(supports all 8.x and 9.x versions) - Migrate from deprecated analyzer Element2 APIs to stable Element APIs
-
10.2.020 Nov 2025Release notes
Open source →- 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
- Add
format_outputbuilder option to control generation of// dart format off/oncomments (default:true)- Set
format_output: falseinbuild.yamlto omit format suppressing comments - This allows combining retrofit with other generators (like riverpod) in a more predictable way
- Set
-
10.1.410 Nov 2025Nothing published for this version
-
10.1.307 Nov 2025Nothing published for this version
-
10.1.229 Oct 2025Nothing published for this version
-
10.1.127 Oct 2025Nothing published for this version
-
10.1.026 Oct 2025Release notes
Open source →- 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.630 Sep 2025 -
10.0.507 Sep 2025 -
10.0.402 Sep 2025Nothing published for this version
-
10.0.207 Aug 2025Release notes
Open source →- Format generated code with default DartFormatter
- Add
dart format offanddart format oncomments to generated code
-
10.0.129 Jul 2025 -
10.0.016 Jul 2025 -
9.7.009 Jul 2025 -
9.6.009 Jul 2025 -
9.3.030 Jun 2025Release notes
Open source →-
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.011 May 2025 -
9.1.909 Feb 2025Release notes
Open source →-
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.809 Feb 2025Release notes
Open source →-
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.730 Dec 2024Release notes
Open source →-
Introduced CallAdapters, This feature allows adaptation of a Call with return type R into the type of T. e.g. Future<User> to Future<Result<User>>
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.630 Dec 2024 withdrawnRelease notes
Open source →- Update
analyzer,dart_styleandsource_gendependencies to allow upper versions
- Update
-
9.1.514 Nov 2024Release notes
Open source →-
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.428 Oct 2024Nothing published for this version
-
9.1.315 Oct 2024Release notes
Open source →-
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.211 Sep 2024Release notes
Open source →-
Support passing Enums into
TypedExtras.Example :
@TypedExtrasSubClass( id: 'abcd', fileType: FileType.json, destinations: [Destination.remote] ) @http.POST('/path/') Future<String> myMethod();
-
-
9.1.108 Sep 2024Nothing published for this version
-
9.1.006 Sep 2024Release notes
Open source →-
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.003 Sep 2024Release notes
Open source →- 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.2.129 Aug 2024Nothing published for this version
-
8.2.013 Aug 2024Nothing published for this version
-
8.1.212 Jul 2024Nothing published for this version
-
8.1.103 Jul 2024Nothing published for this version
-
8.1.003 Feb 2024Release notes
Open source →-
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.616 Dec 2023 -
8.0.506 Dec 2023Release notes
Open source →-
fix #627 where generic argument constructors on any class not directly marked with
@JsonSerializable(genericArgumentFactories: true) -
fix some typos in this changelog.
-
-
8.0.410 Nov 2023Nothing published for this version
-
8.0.328 Oct 2023Nothing published for this version
-
8.0.223 Oct 2023 -
8.0.112 Oct 2023 -
8.0.002 Oct 2023Release notes
Open source →- Add protobuf support
- Add PreventNullToAbsent annotation to allow null sent to server
-
7.0.805 Jul 2023 -
7.0.729 Jun 2023Release notes
Open source →- Enums return types generated iterating over the enum values instead of calling
.toJson()method - Enums as query parameters generated with
.nameinstead oftoJson()
- Enums return types generated iterating over the enum values instead of calling
-
7.0.627 Jun 2023 -
7.0.527 Jun 2023Nothing published for this version
-
7.0.427 Jun 2023 withdrawnNothing published for this version
-
7.0.327 Jun 2023 -
7.0.225 Jun 2023Release notes
Open source →- Fixed generation of
DateTimeused as@Queryparameters (now it is converted toStringusingtoIso8601String)
- Fixed generation of
-
7.0.117 May 2023Release notes
Open source →- Rename
retrofittoretrofit_generatorin build.yaml fix for build_runner ^2.4.4 - Add topics
- Rename
-
7.0.1+120 Jun 2023Nothing published for this version
-
7.0.016 May 2023Release notes
Open source →- Fix deprecated warnings with analyzer 5.12.0
- [BREAKING CHANGE] Require Dart >= 2.19 for new analyzer
-
6.0.009 Mar 2023Release notes
Open source →- [BREAKING CHANGE] Update min Dart sdk to 2.18
- Update example
- Fix link in readme
-
6.0.0+110 Mar 2023Nothing published for this version
-
6.0.0+218 Apr 2023Nothing published for this version