1. Anuncie Aqui ! Entre em contato fdantas@4each.com.br

[Flutter] Flutter GetX - Navigate to specific page after notification, but return to home page...

Discussão em 'Mobile' iniciado por Stack, Outubro 7, 2024 às 09:12.

  1. Stack

    Stack Membro Participativo

    I have created a small app in Flutter, and I'm using GetX as my state manager for navigation. When I receive a notification, I want to navigate to a specific page, and it's working fine. However, when I press the back button after viewing the specific page, the app closes instead of navigating back to the home page.

    This is the code I am using to handle the navigation when a notification is received:

    void handleMessage(RemoteMessage? message) {
    if (message == null) return;

    final data = message.data;
    Get.to(() => ViewNewsScreen(url: data["news_url"]));
    }


    The problem is that after opening ViewNewsScreen from the notification, pressing the back button exits the app. I want it to return to the home page instead.

    I am not using any named routes and would prefer to stick to the GetX navigation system. How can I fix this?

    Any help would be appreciated!

    Continue reading...

Compartilhe esta Página