Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bumped up Dart min version to 3.0.0 for json_serializable #20493

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ publish_to: {{.}}
{{/pubPublishTo}}

environment:
sdk: '>={{#useJsonSerializable}}2.17.0{{/useJsonSerializable}}{{^useJsonSerializable}}2.15.0{{/useJsonSerializable}} <4.0.0'
sdk: '>={{#useJsonSerializable}}3.0.0{{/useJsonSerializable}}{{^useJsonSerializable}}2.15.0{{/useJsonSerializable}} <4.0.0'

dependencies:
dio: '^5.2.0'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: OpenAPI API client
homepage: homepage

environment:
sdk: '>=2.17.0 <4.0.0'
sdk: '>=3.0.0 <4.0.0'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the PR

does it mean the output (dart API client) no longer work with Dart 2.x?

Copy link
Author

@al-kimmel-serj al-kimmel-serj Jan 17, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I use json_serializable as serializationLibrary and I see error when I try to generate code via dart run build_runner build with json_serializable:6.9.0. Here is example of error:

line 18, column 30 of .: Expected to find ')'.
   ╷
18 │         if (instance.message case final value?) 'message': value,
   │                              ^^^^
   ╵

json_serializable generates code with case clauses in if statements since 6.9.0.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about adding an option supportDart2 (default to false) for backward compatibility?

we can't ship a change that breaks all Dart 2.x users.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes. I will add the option to PR.


dependencies:
dio: '^5.2.0'
Expand Down
Loading