admin管理员组文章数量:1122832
I'm using go_router
app navigation both with deep_link
package features. By default the app starts at /
but if a specific url is tapped on the device (other apps) a specific app screen is opened.
So assuming my domain as example
, when I tap on a I'm redirected to the specific route.
final router = GoRouter(
routes: [
GoRoute(
path: '/',
builder: (_, __) => const MyApp(),
),
GoRoute(
path: '/api/app/extevents/:id1',
builder: (_, state) {
Globals.extEventId = int.tryParse(state.pathParameters['id1'] ?? '');
Globals.navigatorKey = GlobalKey<NavigatorState>();
return const MyApp();
},
)
],
onException: (context, state, router) => router.go('/'),
);
void main() {
runApp(
GlobalLoaderOverlay(
overlayWidgetBuilder: (progress) => Theme(
data: RvtTheme.rvtTheme,
child: const Center(
child: CircularProgressIndicator(),
),
),
child: MaterialApp.router(
routerConfig: router,
),
),
);
}
The problem is that it works only once, if I try to tap the link the second time after you navigate on other app screen, I won't be redirected a new time to the desired route.
Does go router cache this route? How to fix that? I need that the route code is evaluated every time.
I'm using go_router
app navigation both with deep_link
package features. By default the app starts at /
but if a specific url is tapped on the device (other apps) a specific app screen is opened.
So assuming my domain as example.com
, when I tap on a https://www.example.com/api/app/extevents/5 I'm redirected to the specific route.
final router = GoRouter(
routes: [
GoRoute(
path: '/',
builder: (_, __) => const MyApp(),
),
GoRoute(
path: '/api/app/extevents/:id1',
builder: (_, state) {
Globals.extEventId = int.tryParse(state.pathParameters['id1'] ?? '');
Globals.navigatorKey = GlobalKey<NavigatorState>();
return const MyApp();
},
)
],
onException: (context, state, router) => router.go('/'),
);
void main() {
runApp(
GlobalLoaderOverlay(
overlayWidgetBuilder: (progress) => Theme(
data: RvtTheme.rvtTheme,
child: const Center(
child: CircularProgressIndicator(),
),
),
child: MaterialApp.router(
routerConfig: router,
),
),
);
}
The problem is that it works only once, if I try to tap the link the second time after you navigate on other app screen, I won't be redirected a new time to the desired route.
Does go router cache this route? How to fix that? I need that the route code is evaluated every time.
Share Improve this question asked Nov 22, 2024 at 18:13 E.BenedosE.Benedos 1,7571 gold badge17 silver badges45 bronze badges 2- Can you provide deep link listener ? – Lightn1ng Commented Nov 25, 2024 at 4:51
- What do you mean for deep link listener? – E.Benedos Commented Nov 26, 2024 at 7:30
1 Answer
Reset to default 0I'm not sure but you might need key: UniqueKey(),
in your GoRoute widgets.
本文标签: fluttergorouter deep link redirect works only onceStack Overflow
版权声明:本文标题:flutter - `go_router` deep link redirect works only once - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1736301678a1931262.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论