Flutter - how to get current context?

前端 未结 3 379
刺人心
刺人心 2021-01-18 20:48

I am using Firebase cloud messaging for notifications, and i want to show a dialog or snackbar once i receive a notification when i am inside the application, my problem is

3条回答
  •  清歌不尽
    2021-01-18 21:28

    I ended up using Overlay support:

    https://pub.dev/packages/overlay_support

    It is basically called at the very beginning of my tree just like wrapping providers at the main.dart, it worked like a charm, nothing else worked at all! Also here is a tutorial that helped me a lot:

    https://medium.com/flutter-community/in-app-notifications-in-flutter-9c1e92ea10b3

提交回复
热议问题