JackJonson / flutter_styled_toast

A Styled Toast Flutter package.
Apache License 2.0
76 stars 42 forks source link

Repeated "Null check operator used on a null value. Error thrown null" error #28

Open egonbeermat opened 1 year ago

egonbeermat commented 1 year ago

Hi, I am unable to reproduce this issue locally myself on any devices or simulators, Android or iOS, but in Crashlytics I am repeatedly seeing this reported crash in production:

Null check operator used on a null value. Error thrown null. at OverlayEntry.remove(overlay.dart:163) at ToastFuture.dismiss(styled_toast_manage.dart:73) at new ToastFuture.create.(styled_toast_manage.dart:50)

It seems that this call in your code to remove an OverlayEntry is called on a null entry, which causes the issue in the Flutter SDK:

styled_toast_manage.dart:73 _entry.remove();

It is being reported from both iOS and Android devices, on a range of operating system versions too. Flutter version is 3.3.10. Any pointers or workarounds would be appreciated, as I'm at a loss how to control this, and this is now my most common crash.

egonbeermat commented 1 year ago

Assuming this component is abandoned due to the general lack of updates and responses to issues, but for anyone with this issue it can be resolved by modifying styled_toast_manage.dart:73 to:

if (_entry.mounted) {
  _entry.remove();
}