diegoveloper / flutter_percent_indicator

Flutter percent indicator library
BSD 2-Clause "Simplified" License
679 stars 206 forks source link

Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null. #159

Closed iBelow closed 2 years ago

iBelow commented 2 years ago

after installing error on building:

/C:/tools/flutter-sdk/.pub-cache/hosted/pub.dartlang.org/percent_indicator-4.2.0/lib/linear_percent_indicator.dart:162:29: Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/C:/tools/flutter-sdk/packages/flutter/lib/src/widgets/binding.dart').
package:flutter/…/widgets/binding.dart:1
Try calling using ?. instead.
    WidgetsBinding.instance.addPostFrameCallback((_) {
                            ^^^^^^^^^^^^^^^^^^^^
diegoveloper commented 2 years ago

use a version before this (4.0.1), the latest version is compatible with flutter 3.0.