JackJonson/flutter_styled_toast

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

egonbeermat opened this issue · 1 comments

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.

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();
}