Open fennelhans opened 2 years ago
This is how other teams are solving it:
(WidgetsBinding.instance as WidgetsBinding).addObserver(this);
Thanks for help @fennelhans . Shall fix soon
I tried running example app on flutter 3.0.1 but couldn't find any issue.
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((_) {
^
Pie chart doesnt use WidgetsBinding. I dont see any warning when running project locally on latest flutter
In Flutter 3,
WidgetsBinding.instance
no longer requires a null safety check.