Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
When importing 'package:noob/noob.dart', with flutter stable v3.0.5, we see a bunch of red warnings in the console about using the null-check operator
!
overWidgetsBinding.instance
, that is not nullable.Warnings as seen in console
flutter doctor
Solution
Remove redundant null-check operator
!
overWidgetsBinding.instance
Unresolved topics
Compatibility with previous versions
I'm assuming this was working without warnings in previous versions of flutter, where WidgetsBinding was nullable, likely to not supporting null-safety at that time.
We may need to ensure that compatibility between different flutter versions and this package, but since I don't know much about this right now, I didn't resolve this aspect.
TrackingBuildOwnerWidgetsFlutterBinding.ensureInitialized is not working
TrackingBuildOwnerWidgetsFlutterBinding.ensureInitialized
is not working, as it's checking ifWidgetsBinding.instance
is null, which won't happen:But calling
TrackingBuildOwnerWidgetsFlutterBinding();
instead before creating a BuildTracker works fine:There seems to be some changes in recent versions of flutter about how this is handled; and calling
TrackingBuildOwnerWidgetsFlutterBinding();
directly sounds like a small hack, but it works for me.Increase version number and add entry in the changelog
As I don't know if this must be a 0.0.8 or a 1.0.0 (if fixing ensureInitialized ends up in a breaking change), I still haven't added an entry on the changelog.