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

Add null safety support #26

Merged
merged 8 commits into from Mar 5, 2021
Merged

Add null safety support #26

merged 8 commits into from Mar 5, 2021

Conversation

6h4n3m
Copy link
Contributor

@6h4n3m 6h4n3m commented Mar 4, 2021

Hey,

So as discussed, I've taken care of the changes necessary to support null safety for Flutter 2.0 and Dart version from 2.12 and above.

Changes made:

  1. Bumped SDK restriction from 2.7.0 to 2.12.0 (new minimum).
  2. Removed the meta package dependency since the @required annotation has been replaced and is not needed for named parameters anymore.
  3. Added the required modifier to any required parameters in widgets and/or functions.
  4. Changed the types of any optional named parameters to be nullable (ex. from String to String?).
  5. Removed unnecessary not null asserts for required parameters as package users cannot send nullable values for these anymore.
  6. Replaced the DynamicTheme dependency with the actively maintained AdaptiveTheme in order to make sure the package supports sound null safety and is not in mixed mode (ie. depends on packages with no null safety).
  7. Replaced deprecated widget FlatButton with the replacement ElevatedButton where applicable (no changes to api surface of the package were made).

I ran the example app and everything works smoothly including theme switching.

You'd probably need to bump this into a new major version since it requires and SDK upgrade on the user's part.

Resolves #25

@6h4n3m
Copy link
Contributor Author

6h4n3m commented Mar 5, 2021

I think the CodeFactor issues are because the service doesn't support Dart null safety features yet... the two errors found make no sense.

@codegrue codegrue merged commit 073d008 into codegrue:master Mar 5, 2021
@Joseph-Nathan
Copy link

how can i used this ?
should i change all docs ?

@6h4n3m
Copy link
Contributor Author

6h4n3m commented Mar 6, 2021

how can i used this ?
should i change all docs ?

Version 2.0.0 is not on Pub yet due to some breaking changes in theming some picker widgets in Flutter 2.0 , @codegrue is still taking care of these.

In the meantime, you can depend on Master by doing something like this:

dependencies:
  flutter_material_pickers:
    git:
      url: git://github.com:codegrue/flutter_material_pickers.git

I would recommend that you hold off on doing this though, you might forget to change it back when the stable version hits Pub or there might be some breaking changes introduced into Master at any point.

@codegrue
Copy link
Owner

codegrue commented Mar 6, 2021

If you guys could test that would be great. Timepicker is as good as it gets without the Flutter team making some changes. I plan to publish on Monday.

@6h4n3m
Copy link
Contributor Author

6h4n3m commented Mar 6, 2021

I'll pull upstream and let you know if I find anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Null Safety Support
3 participants