Hi,
I'm working on an app on Flutter stable channel, and I'm currently on Flutter version 2.0.4. This app is not null-safe, as its development has started long before null-safety announcement.
I updated all libraries to be able to use Flutter 2.0, but I'm not intending to migrate to null-safety.
I found out that, on these premises, I cannot regenerate my serializable files (.g.dart files) as json_serializable incurs in the following error:
[SEVERE] json_serializable:json_serializable on lib/models/social/like_model.dart:
Generator cannot target libraries that have not been migrated to null-safety.
package:resmedia_manita_flutter/models/social/like_model.dart:6:7
â•·
6 │ class LikeModel {
│ ^^^^^^^^^
╵
[INFO] 13.1s elapsed, 108/114 actions completed.
I understand that retrocompatibility is a torture, but I think that this library should, as many others, be able to be used on latest Flutter without null-safety.
Here's the output of my flutter --version.
Flutter 2.0.4 • channel stable • https://github.com/flutter/flutter.git
Framework • revision b1395592de (3 days ago) • 2021-04-01 14:25:01 -0700
Engine • revision 2dce47073a
Tools • Dart 2.12.2
You can always use an old version of json_serializable. Set your constraint to ^3.0.0 and you should be good.
json_serializable
That is not always feasible: older versions of json_serializable are not compatible with other dependencies of the app.
I'm sorry, @emiliodallatorre – we have no plans to offer something in-the-middle here.