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

Flutter 3 issue #82

Open
fennelhans opened this issue May 12, 2022 · 5 comments
Open

Flutter 3 issue #82

fennelhans opened this issue May 12, 2022 · 5 comments

Comments

@fennelhans
Copy link

In Flutter 3, WidgetsBinding.instance no longer requires a null safety check.

: Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.
..//pie_chart/pie_chart.dart:42
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../../bin/flutter/packages/flutter/lib/src/widgets/binding.dart').
package:flutter//widgets/binding.dart:1
    WidgetsBinding.instance?.addPostFrameCallback((_) {
@fennelhans
Copy link
Author

This is how other teams are solving it:
(WidgetsBinding.instance as WidgetsBinding).addObserver(this);

@apgapg
Copy link
Owner

apgapg commented May 19, 2022

Thanks for help @fennelhans . Shall fix soon

@apgapg apgapg added the good first issue Good for newcomers label May 19, 2022
@apgapg
Copy link
Owner

apgapg commented May 22, 2022

I tried running example app on flutter 3.0.1 but couldn't find any issue.

@mahoraz
Copy link

mahoraz commented Jun 20, 2022

I tried running example app on flutter 3.0.1 but couldn't find any issue.

they changed WidgetBinding.instance null-aware checking operator issue into a warning (it was classified as an exception during build with flutter 3.0.0 and would prevent compilation before 3.0.1). It still shows up as a warning during debug


: Warning: Operand of null-aware operation '?.' has type 'WidgetsBinding' which excludes null.
../…/pie_chart/pie_chart.dart:42
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('../../../../Documents/flutter/packages/flutter/lib/src/widgets/binding.dart').
package:flutter/…/widgets/binding.dart:1
    WidgetsBinding.instance?.addPostFrameCallback((_) {
                   ^

@apgapg
Copy link
Owner

apgapg commented Jul 5, 2022

Pie chart doesnt use WidgetsBinding.
I dont see any warning when running project locally on latest flutter

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

No branches or pull requests

3 participants