code_builder icon indicating copy to clipboard operation
code_builder copied to clipboard

Add support for nullsafety

Open vanlooverenkoen opened this issue 5 years ago • 7 comments

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?

vanlooverenkoen avatar Nov 22 '20 11:11 vanlooverenkoen

No, sorry. This project is best effort only.

matanlurey avatar Dec 29 '20 00:12 matanlurey

@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.

remonh87 avatar Jan 07 '21 15:01 remonh87

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?

smkhalsa avatar Mar 05 '21 08:03 smkhalsa

Yes I agree, having null safety supported on this one would be very important.

marcschw avatar Mar 05 '21 11:03 marcschw

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

alanrussian avatar Mar 06 '21 01:03 alanrussian

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.

davidmorgan avatar Mar 06 '21 06:03 davidmorgan

Locking since we're aware at this point folks want this. Thanks!

matanlurey avatar Mar 08 '21 18:03 matanlurey

Looks like this was done in https://github.com/dart-lang/code_builder/pull/317.

devoncarew avatar Dec 03 '22 23:12 devoncarew