Keyboard Shortcuts

j / kScroll down / up
ggScroll to top
GScroll to bottom
K / /Open search
?Show this help
EscClose search / help
n / NNext / previous section
hGo to landing
dGo to docs
:Command mode — type section name

Press ? or Esc to close

Architecture

Deep Linking

Incoming links — from the OS, another app, or a push notification — are resolved to a route by DeepLinkService and navigated after the first frame paints.

How it works

OS opens link / push tapped
MethodChannel 'com.example.app/deep_links'
DeepLinkService._resolve()
feed/* feedRoute
profile/* profileRoute
notifications notificationsRoute
appRouter.go(resolvedRoute)

Lifecycle

The service is started in App.initState and disposed in dispose. Navigation happens inside a post-frame callback so it never races with the initial route build.

lib/app/app.dart
@override
void initState() {
  super.initState();
  DeepLinkService.instance.init(
    onResolved: (path) {
      WidgetsBinding.instance.addPostFrameCallback((_) {
        appRouter.go(path);
      });
    },
  );
}

@override
void dispose() {
  DeepLinkService.instance.dispose();
  super.dispose();
}

Resolution

Links are matched by prefix and mapped to the corresponding AppRoutes path, including dynamic segments like a user id.

lib/config/utils/deep_link/deep_link_service.dart
String _resolve(Uri uri) {
  if (uri.path.startsWith('/feed')) return AppRoutes.feed.route;
  if (uri.path.startsWith('/profile')) {
    final id = uri.pathSegments.elementAt(1);
    return AppRoutes.profileView.route.replaceFirst(':id', id);
  }
  if (uri.path.startsWith('/notifications')) return AppRoutes.notifications.route;
  return AppRoutes.home.route;
}
Note: deep-linked routes that require auth go through the same redirect guard as every other navigation.
sam's arch — A Pragmatic Flutter Architecture