I’m trying to handle a deeplink using the autoRoute package, how can I make my deeplink work when the url is opened?
here is my deeplink handler code
MaterialApp.router(
title: 'Flutter Demo',
routerConfig: _appRouter.config(
navigatorObservers: () => [AutoRouteObserver()],
deepLinkBuilder: (link) {
print(link.path);
if(link.path.startsWith('/ru/reset-password')) {
return const DeepLink(
[ResetPassRoute()]
);
} else {
return DeepLink.defaultPath;
}
}
),
),
/// route config
@AutoRouterConfig()
class AppRouter extends _$AppRouter {
@override
List<AutoRoute> get routes => [
AutoRoute(page: MainRoute.page, initial: true, children: [
AutoRoute(page: HomeRoute.page),
AutoRoute(page: HelpRoute.page),
AutoRoute(page: AboutRoute.page),
AutoRoute(page: ContactsRoute.page),
AutoRoute(page: ConfidenceRoute.page),
AutoRoute(page: TermsRoute.page),
AutoRoute(page: FavoriteRoute.page),
AutoRoute(page: CreateRoute.page),
AutoRoute(page: MessageRoute.page),
AutoRoute(page: ProfileRoute.page),
AutoRoute(page: RegistrationRoute.page),
]),
AutoRoute(page: RegistrationRoute.page),
AutoRoute(page: ResetPassRoute.page),
];
}
when I open my url my-url/ru/reset-password
nothing happend, how can i fix it?
2
Answers
Make sure you’ve setup your AndroidManifest.xml and Info.plist files to handle the deep links.
For AndroidManifest.xml you can add something like this:
For Info.plist you can add something like this:
Please check your condition and try this :