cmdrootaccess / another-flushbar

A flexible widget for user notification. Customize your text, button, duration, animations and much more. For Android devs, it is made to replace Snackbars and Toasts.
https://pub.dev/packages/another_flushbar
MIT License
145 stars 88 forks source link

Error: Method 'addPostFrameCallback' #81

Closed xiaochenghua closed 1 year ago

xiaochenghua commented 2 years ago

../../../../.pub-cache/hosted/pub.dartlang.org/another_flushbar-1.10.29/lib/flushbar.dart:350:31: Error: Method 'addPostFrameCallback' cannot be called on 'SchedulerBinding?' because it is potentially null.

xiaochenghua commented 2 years ago

➜ ~ flutter doctor -v
[✓] Flutter (Channel stable, 2.10.2, on macOS 12.4 21F79 darwin-x64, locale zh-Hans-CN) • Flutter version 2.10.2 at /Users/chenghua/fvm/versions/2.10.2 • Upstream repository https://github.com/flutter/flutter.git • Framework revision 097d3313d8 (5 months ago), 2022-02-18 19:33:08 -0600 • Engine revision a83ed0e5e3 • Dart version 2.16.1 • DevTools version 2.9.2

[✓] Android toolchain - develop for Android devices (Android SDK version 31.0.0) • Android SDK at /Users/chenghua/Library/Android/sdk • Platform android-31, build-tools 31.0.0 • ANDROID_HOME = /Users/chenghua/Library/Android/sdk • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822) • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 13.1) • Xcode at /Applications/Xcode.app/Contents/Developer • CocoaPods version 1.11.2

[✓] Android Studio (version 2021.1) • Android Studio at /Applications/Android Studio.app/Contents • Flutter plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/9212-flutter • Dart plugin can be installed from: 🔨 https://plugins.jetbrains.com/plugin/6351-dart • Java version OpenJDK Runtime Environment (build 11.0.11+0-b60-7590822)

[✓] VS Code (version 1.69.0) • VS Code at /Applications/Visual Studio Code.app/Contents • Flutter extension version 3.44.0

[✓] Connected device (1 available) • iPhone 13 (mobile) • DCFCD6AF-9B56-4285-82C6-03268E02C309 • ios • com.apple.CoreSimulator.SimRuntime.iOS-15-0 (simulator)

[✓] HTTP Host Availability • All required HTTP hosts are available

• No issues found!

Kuri-Tai commented 2 years ago

I have changed pubspec.yaml, then ran flutter clean and flutter pub get. It worked.

...
# another_flushbar: ^1.10.29 # before
another_flushbar: 1.10.28 # after 
# or
another_flushbar: <=1.10.28 # etc.

https://github.com/cmdrootaccess/another-flushbar/commit/22c547036591bb482c01fc2263532cffab74731e#diff-31c0a3f2a09ed06c40eaf4a0ef3a079e92097ac3779f18028d73ced2e457b45a

I guess this commit has changed the relevant code, then it started getting errors with Flutter which versions under 3.0.0.

Kuri-Tai commented 2 years ago

I propose to add a constraint on the version of Flutter in pubspec.yaml as follows,

environment:
  sdk: ...
  flutter: '>=3.0.0'
cmdrootaccess commented 1 year ago

Please upgrade to flutter 3 and this issue will be resolved