Flutter · One codebase, native feel
How do you implement deep links for iOS and Android?
Short answer
Register a custom scheme or verified HTTPS link, map the URL through a router, and handle cold and warm starts. Universal Links and Android App Links need domain verification files.
A deep link is a URL that opens a specific screen. Custom schemes are easy but can be claimed by other apps. Verified HTTPS links are more secure because the OS checks that your app is authorised for the domain. iOS calls these Universal Links and Android calls them App Links.
final router = GoRouter(
routes: [
GoRoute(
path: '/orders/:id',
builder: (context, state) {
final id = state.pathParameters['id'];
if (id == null) return const NotFoundPage();
return OrderPage(orderId: id);
},
),
],
);- iOS needs Associated Domains entitlement and an apple-app-site-association file served over HTTPS
- Android needs intent filters and a Digital Asset Links file with the signing certificate fingerprint
- Route every screen from identifiers so a link works without in-memory state
- Handle the initial link on cold start and subsequent links while running
- Provide a web fallback for users without the app and a clear error for invalid links
Security and testing
Treat every path and query parameter as untrusted. Validate ids, reject unexpected hosts and avoid open redirects that forward to arbitrary URLs. Test links from a messaging app, a browser and a terminated state, because each launch path can behave differently. Verify production signing fingerprints, not only debug ones.
Follow-ups you should expect
Interviewers use these to check whether the first answer was understanding or memorisation.
- 1What is the difference between a custom scheme and a verified HTTPS link?
- 2Why can deep links fail only in production?
- 3How do you test a cold-start deep link?
- 4What prevents an open redirect through a deep link?
Say it in the interview
I prefer verified HTTPS links because the OS checks domain ownership, while custom schemes are easier for other apps to claim. The router maps the URL to a screen, and every route must build itself from ids rather than assuming state. I handle cold start and warm start separately, validate parameters as untrusted input, and verify production signing fingerprints for Android App Links.
Use this as a model, not a script. Saying it in your own words is what makes it survive follow-up pressure.
Related questions
Reading is step one
Now say it out loud.
Understanding an answer and delivering it under pressure are different skills. Rehearse this topic in a live Flutter mock interview and get scored feedback on depth, clarity and confidence.