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
146 stars 90 forks source link

Unhandled Exception: Null check operator used on a null value #56

Closed zzzaJ closed 1 year ago

zzzaJ commented 2 years ago

When trying to show a FlushbarHelper.createSuccess() flusher, it fails with the following error and trace stack:

Unhandled Exception: Null check operator used on a null value

0 StatefulElement.state

package:flutter/…/widgets/framework.dart:4789

1 Navigator.of

package:flutter/…/widgets/navigator.dart:2730

2 Flushbar.show

package:another_flushbar/flushbar.dart:233

3 _LoginState.build.

package:app/…/auth/login.dart:258

I am not sure why this is the case, and any help or advice would be great.

kcchenkd commented 2 years ago

Observing the same error on 1.10.28 version

I/flutter ( 4761): ----------------FIREBASE CRASHLYTICS---------------- I/flutter ( 4761): Null check operator used on a null value I/flutter ( 4761): I/flutter ( 4761): #0 StatefulElement.state package:flutter/…/widgets/framework.dart:4712 I/flutter ( 4761): #1 Navigator.of package:flutter/…/widgets/navigator.dart:2542 I/flutter ( 4761): #2 Flushbar.show package:another_flushbar/flushbar.dart:233 I/flutter ( 4761): #3 _HomePageState._showFlushBar package:groubing/…/pages/home_page.dart:358 I/flutter ( 4761): #4 _HomePageState._configureFcm. package:groubing/…/pages/home_page.dart:301 I/flutter ( 4761): #5 _rootRunUnary (dart:async/zone.dart:1436:47) I/flutter ( 4761): #6 _CustomZone.runUnary (dart:async/zone.dart:1335:19) I/flutter ( 4761): #7 _CustomZone.runUnaryGuarded (dart:async/zone.dart:1244:7) I/flutter ( 4761): #8 _BufferingStreamSubscription._sendData (dart:async/stream_impl.dart:341:11) I/flutter ( 4761): #9 _DelayedData.perform (dart:async/stream_impl.dart:591:14) I/flutter ( 4761): #10 _StreamImplEvents.handleNext (dart:async/stream_impl.dart:706:11) I/flutter ( 4761): #11 _PendingEvents.schedule. (dart:async/stream_impl.dart:663:7) I/flutter ( 4761): #12 _rootRun (dart:async/zone.dart:1420:47) I/flutter ( 4761): #13 CustomZone.run (dart:async/zone.dart:1328:19) I/flutter ( 4761): #14 I/flutter ( 4761): ----------------------------------------------------

bagus-repository commented 2 years ago

I do have same issue

cyb9701 commented 2 years ago

The reason for this error is that the Flushbar result value is null. Therefore, if the bool enables null, no error occurs.

Flushbar<bool?>? _flushBar;

_flushBar = Flushbar<bool?>()