Hello,
In my Flutter project when i build g file of JsonSerializable using pub run build_runner build command,it gives the error of generator cannot target libraries that have not been migrated to null-safety.
Here is the version of package which i used:
flutter version - 2.12.0
dart version - 2.12.0
json_serializable : 4.0.2
json_annotation : 4.0.0
build_runner: ^1.11.5
As I mentioned Dart Version is already 2.12.
same problem here
````
environment:
sdk: ">=2.7.0 <3.0.0"
dependencies:
flutter:
sdk: flutter
flutter_hooks: ^0.16.0
hooks_riverpod: ^0.13.0
charts_flutter: ^0.9.0
http: ^0.12.2
darq: ^0.5.1
intl: ^0.16.1
cached_network_image: ^2.5.0
flutter_svg: ^0.19.1
json_annotation: ^4.0.0
# The following adds the Cupertino Icons font to your application.
# Use with the CupertinoIcons class for iOS style icons.
cupertino_icons: ^1.0.0
dev_dependencies:
flutter_test:
sdk: flutter
build_runner: ^1.11.5
json_serializable: ^4.0.2
Dart SDK version: 2.12.0 (stable) (Thu Feb 25 19:50:53 2021 +0100) on "windows_x64"````
You MUST set sdk: '>=2.12.0 <3.0.0'
The json_serializable and json_annotation ^4.0.0
On Sun, Mar 7, 2021 at 9:03 PM KalpShah412 notifications@github.com wrote:
I got the one solution, You can use the dependency_overrides for now
until new release of build_runner version.dependency_overrides:
json_annotation: ">=3.1.1"
json_serializable: ">=3.5.1"—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/google/json_serializable.dart/issues/823#issuecomment-792464249,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAEFCTSI4EH2LKOG3LMJUTTCRLCXANCNFSM4YWV4Y4Q
.
You MUST set
sdk: '>=2.12.0 <3.0.0'The json_serializable and json_annotation ^4.0.0
…
On Sun, Mar 7, 2021 at 9:03 PM KalpShah412 @.*> wrote: I got the one solution, You can use the dependency_overrides for now until new release of build_runner version. dependency_overrides: json_annotation: ">=3.1.1" json_serializable: ">=3.5.1" — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#823 (comment)>, or unsubscribe <github.com/notifications/unsubscribe-auth/AAAEFCTSI4EH2LKOG3LMJUTTCRLCXANCNFSM4YWV4Y4Q> .
@kevmoo it didn't work, I'm getting a similar error.
What's your pubspec Dart SDK constraint? Have you ran pub get or pub upgrade before running the builder?
I have executed both pub command and my current SDK version is ">=2.12.0 <3.0.0"
You must change that to ">=2.12.0 <3.0.0"
If you don't have Dart 2.12, you need to get it!
On Mon, Mar 22, 2021 at 9:23 PM Shoeb Surve @.*>
wrote:
I have executed both pub command and my current SDK version is ">=2.7.0
<3.0.0"—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
https://github.com/google/json_serializable.dart/issues/823#issuecomment-804606347,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AAAEFCSRZEU7FRZVKGCBWUDTFAJUHANCNFSM4YWV4Y4Q
.
I have updated my environment from 2.7.0 to 2.12.0 but still, error exists.
You must change that to ">=2.12.0 <3.0.0" If you don't have Dart 2.12, you need to get it!
…
On Mon, Mar 22, 2021 at 9:23 PM Shoeb Surve ***@***.***> wrote: I have executed both pub command and my current SDK version is ">=2.7.0 <3.0.0" — You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub <#823 (comment)>, or unsubscribe <github.com/notifications/unsubscribe-auth/AAAEFCSRZEU7FRZVKGCBWUDTFAJUHANCNFSM4YWV4Y4Q> .
would you paste the full error here?
Error
Generator cannot target libraries that have not been migrated to null-safety.
package:my_package/datamodels/user_data.dart:12:7
â•·
12 │ class UserData {
│ ^^^^^^^^
╵
[SEVERE] json_serializable:json_serializable on lib/app/locator.config.dart:
Hi, i have the same problem here, even when i update my SDK to 2.12, what could i do with it?
Hi, i have the same problem here, even when i update my SDK to 2.12, what could i do with it?
Hey, please upgrade your json packages like,
sdk: '>=2.12.0 <3.0.0'
json_annotation: ^4.0.1
json_serializable: ^4.1.0
build_runner: ^1.12.2
After upgrade the packages to run this command:
flutter pub run build_runner build --delete-conflicting-outputs
You MUST set
sdk: '>=2.12.0 <3.0.0'The json_serializable and json_annotation ^4.0.0
…
Great. You saved my life :)
Most helpful comment
You MUST set
sdk: '>=2.12.0 <3.0.0'The json_serializable and json_annotation ^4.0.0
On Sun, Mar 7, 2021 at 9:03 PM KalpShah412 notifications@github.com wrote: