Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null
I think, reason of this error isn't in my code, because I delete it and left only
import 'package:scroll_snap_list/scroll_snap_list.dart';
It's error text ->
/C:/Users/User/AppData/Local/Pub/Cache/hosted/pub.dartlang.org/scroll_snap_list-0.9.1/lib/scroll_snap_list.dart:177:29: Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null.
- 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/binding.dart').
Try calling using ?. instead.
WidgetsBinding.instance.addPostFrameCallback((_) {
Pacakge: https://pub.dev/packages/scroll_snap_list
I read same questions on StackOverflow, and trying reinstall 'scroll_snap_list' package, and remove '^' near 'scroll_snap_list:' in pubspec.yaml
Now it requirement look like scroll_snap_list: 0.9.1
, but i still have that error
Problem was solved by upgrading flutter version to actual: 3.10.6