Add support for nullsafety
I am upgrading my package (Kiwi) vanlooverenkoen/kiwi#51
But it seems that code_builder is not yet migrated to support nullsafety. Is there a timeline on when this could be added?
No, sorry. This project is best effort only.
@matanlurey I think it would be great to at least add references to null-safe version of external dependencies (in my case built_value). Because of outdated dependencies I cannot use protobuf null-safety combined with mockito null-safety. See also issue mockito
I am willing to help out on this.
Repo steps
Add the following dependencies to pubspec.yaml
dependencies:
protobuf: ^2.0.0-nullsafety
dev_dependencies:
build_runner: ^1.10.11
flutter_test:
sdk: flutter
mockito: ^5.0.0-nullsafety
Because mockito >=4.1.2 depends on code_builder ^3.4.0 which depends on built_value ^7.0.0, mockito >=4.1.2 requires built_value ^7.0.0.
And because built_value >=5.5.5 <8.0.0-nullsafety.0 depends on fixnum ^0.10.0, mockito >=4.1.2 requires fixnum ^0.10.0.
And because protobuf 2.0.0-nullsafety.0 depends on fixnum ^1.0.0-nullsafety.0 and no versions of protobuf match >=2.0.0-nullsafety <2.0.0-nullsafety.0 or >2.0.0-nullsafety.0 <3.0.0, mockito >=4.1.2 is incompatible with protobuf ^2.0.0-nullsafety.
So, because flutter_reactive_ble depends on both protobuf ^2.0.0-nullsafety and mockito ^5.0.0-nullsafety, version solving failed.
Now that flutter 2.0 and dart 2.12 have been released, I really hope we can make some progress on this.
code_builder is one of the last dependencies that I'm waiting on to migrate my projects.
@matanlurey is there any internal effort being made to migrate this library?
Yes I agree, having null safety supported on this one would be very important.
cc @davidmorgan this is probably going to block null-safety migration in g3, so it would be nice if we could get this prioritized. We ran into an issue in one of our projects, but that might be resolved with https://github.com/dart-lang/code_builder/pull/310
Note that generators often do not (urgently) need to migrate--it is the code they produce that should be null safe, not the generator itself. If the generator is a dev_dependency it won't block your own migration.
#310 makes sense since it's needed to generate null safe code, as does bumping dependencies.
Please highlight if you need more than that. Thanks.
Locking since we're aware at this point folks want this. Thanks!
Looks like this was done in https://github.com/dart-lang/code_builder/pull/317.