Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to open notifications from background tasks? OverlaySupport Not Initialized #89

Open
josefrvaldes opened this issue Mar 1, 2023 · 1 comment

Comments

@josefrvaldes
Copy link

Hi, I'm using this library and I can display notifications easily when calling this code from within a screen.
showOverlayNotification( (context) { return Card(...); }, duration: Duration(milliseconds: 8000), );

But if I call the same code from within a background process which is not tied to any screen, I receive this error: _AssertionError ('package:overlay_support/src/overlay.dart': Failed assertion: line 59 pos 10: '_debugInitialized': OverlaySupport Not Initialized ! ensure your app wrapped widget OverlaySupport).

I'm using 1.0.5-hotfix1 version since in this project I'm tied to flutter version 1.22.6. So I can't use OverlaySupport.global().

I'm using OverlaySupport(child: MaterialApp(...)). If I try to also add OverlaySupport to all the screens, I receive the error There is already an OverlaySupport in the Widget tree.

@Hamitix
Copy link

Hamitix commented May 30, 2023

Hello, I have the same issue when opening the app from a deeplink. (The app isn't open before using the deeplink)
This error only happens on Android. On iOS, it's fine.

The error is :
"""
'package:overlay_support/src/overlay_state_finder.dart': Failed assertion: line 12 pos 7: '_debugInitialized': Global OverlaySupport Not Initialized !
ensure your app wrapped widget OverlaySupport.global

#0 _AssertionError._doThrowNew (dart:core-patch/errors_patch.dart:51:61)
#1 _AssertionError._throwNew (dart:core-patch/errors_patch.dart:40:5)
#2 findOverlayState (package:overlay_support/src/overlay_state_finder.dart:12:7)
#3 showOverlay (package:overlay_support/src/overlay.dart:63:26)
#4 showOverlayNotification (package:overlay_support/src/notification/overlay_notification.dart:21:10)
"""

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants