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

0.3.2-null-safety complaints about unnecessary WidgetsBinding.instance? null check. #82

Closed
RoarGronmo opened this issue Apr 30, 2022 · 4 comments · Fixed by #97
Closed

Comments

@RoarGronmo
Copy link

Getting theese warnings:

/C:/Flutter/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_settings_screens-0.3.2-null-safety/lib/src/widgets/settings_widgets.dart:613:20: Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.
 - 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/C:/Flutter/flutter/packages/flutter/lib/src/widgets/binding.dart').
    WidgetsBinding.instance?.addPostFrameCallback((_) {
                   ^
DartUri: Unresolved uri: dart:web_sql
DartUri: Unresolved uri: dart:ui

Any hope for null safe release which addresses this particular problem ?

@laogao
Copy link

laogao commented May 22, 2022

Maybe we could define and use some function such as T? _ambiguate<T>(T? value) => value; to wrap access to WidgetsBinding.instance, which treats values of both T and T? equally as T?. When everyone is on Flutter 3.0.0+, we can then drop it?

@tarun-netweb
Copy link

tarun-netweb commented Jul 1, 2022

Same problem here:-

: Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.
../…/widgets/settings_widgets.dart:581

  • 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../snap/flutter/common/flutter/packages/flutter/lib/src/widgets/binding.dart').
    package:flutter/…/widgets/binding.dart:1
    WidgetsBinding.instance?.addPostFrameCallback((_) {

===================================
Can you solve it in next update ?

@ec-ecss
Copy link

ec-ecss commented Jul 7, 2022

Same here, the whole copy paste :
`
../../../tools/flutter-sdk/.pub-cache/hosted/pub.dartlang.org/flutter_settings_screens-0.3.3-null-safety+1/lib/src/widgets/settings_widgets.dart:676:20: Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.

  • 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../tools/flutter-sdk/packages/flutter/lib/src/widgets/binding.dart').
    WidgetsBinding.instance?.addPostFrameCallback((_) {
    ^`

@GAM3RG33K
Copy link
Owner

@nyxkn Can you take a look at these issues generated by the latest flutter stable/beta sdk update?
I am planning to resolve this maybe during this weekend or by the end of next week.

If you can just the issues & provide a list of it here, we can connect over the weekend & get it done. I am sure it won't be a long list of changes for this.

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 a pull request may close this issue.

5 participants