skip to Main Content

Android Studio – Flutter Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null

Whenever I try to run flutter app, I am getting this error. ../flutter/.pub-cache/hosted/pub.dartlang.org/percent_indicator-4.2.1/lib/linear_percent_indicator.dart:162:5: Warning: The class 'WidgetsBinding' cannot be null. Try replacing '?.' with '.' WidgetsBinding?.instance.addPostFrameCallback((_) { ^^^^^^^^^^^^^^ ../flutter/.pub-cache/hosted/pub.dartlang.org/percent_indicator-4.2.1/lib/linear_percent_indicator.dart:162:30: Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is…

VIEW QUESTION

Android Studio – Error: Method 'addPostFrameCallback' cannot be called on 'SchedulerBinding?'

how can I fix this error in flutter with android studio /C:/src/flutterSDK/flutter/.pub-cache/hosted/pub.dartlang.org/get-4.6.3/lib/get_navigation/src/snackbar/snackbar.dart:452:31: Error: Method 'addPostFrameCallback' cannot be called on 'SchedulerBinding?' because it is potentially null. 'SchedulerBinding' is from 'package:flutter/src/scheduler/binding.dart' ('/C:/src/flutterSDK/flutter/packages/flutter/lib/src/scheduler/binding.dart'). Try calling using ?. instead. SchedulerBinding.instance.addPostFrameCallback( ^^^^^^^^^^^^^^^^^^^^

VIEW QUESTION
Back To Top
Search