1

I have a project that uses getX and initialRoute is "/root".

runApp(
GetMaterialApp.router(
  title: "Application",
  getPages: AppPages.routes,
  routeInformationParser: GetInformationParser(
    initialRoute: Routes.ROOT,
  ),
),

I'm trying to use firebase dynamic linking to open app when click/open link. When I run app from IDE (not by open link), the "GetInformationParser route location" is "/root" and everything goes correctly, but when I kill app and opens with the link (eg: https://myapp.com/ABC123) so the "GetInformationParser route location" is "/ABC123" and I get the error "Bad state: No element" with black screen. If I change link to "https://myapp.com/root" the app runs ok, but I have to create and use data from the link so I can't just use "https://myapp.com/root". If someone can help me understand the issue, that would be great.

Hoang Phuc
  • 92
  • 6
  • hello @Hoang Phuc, did you found any answer ? or how you fixed this ? I'm facing same using GetX and firebase dynamicLinks ? – Dhiren Basra Jul 24 '23 at 16:24
  • I'm fixing it temporarily by overriding the position value in the GetInformationParser so it doesn't pick up the value from the link anymore. – Hoang Phuc Jul 30 '23 at 22:36

1 Answers1

1

If I understood your problem correctly. I faced a similar problem, but I didn't receive any error messages.

Instead, when I opened a dynamic link it would navigate me to a named page with the path of the link as in your example it would transfer me to a page route of ABC123 directly, before even triggering the onLink function from the FirebaseDynamicLinks.

So I always ended up on the start page. which had a routing of '/', so i changed it to '/startPage' and it worked for me. turns out that maybe some routing names are reserved.

So try to add initialRoute value as something like '/startPage' and make sure you don't have in your routes a page with a named route of '/' or any possibly reserved names. this answer helped me solve my problem you can check it out https://stackoverflow.com/a/69458347/9986601

Abduu Atef
  • 23
  • 4