text stringlengths 1 372 |
|---|
verify that your browser can access this file. |
<topic_end> |
<topic_start> |
testing |
you can use a real device or the emulator to test an app link, |
but first make sure you have executed flutter run at least once on |
the devices. this ensures that the flutter application is installed. |
to test only the app setup, use the adb command: |
info note |
this doesn’t test whether the web files are |
hosted correctly, |
the command launches the app even |
if web files are not presented. |
to test both web and app setup, you must click a link |
directly through web browser or another app. |
one way is to create a google doc, add the link, and tap on it. |
if everything is set up correctly, the flutter application |
launches and displays the details screen: |
<topic_end> |
<topic_start> |
appendix |
source code: deeplink_cookbook |
<topic_end> |
<topic_start> |
set up universal links for iOS |
deep linking is a mechanism for launching an app with a URI. this URI |
contains scheme, host, and path, and opens the app to a specific |
screen. |
a universal link is a type of deep link that uses http or https |
and is exclusive to apple devices. |
setting up universal links requires one to own a web domain. |
otherwise, consider using firebase hosting or GitHub pages |
as a temporary solution. |
<topic_end> |
<topic_start> |
1. customize a flutter application |
write a flutter app that can handle an incoming URL. |
this example uses the go_router package to handle the routing. |
the flutter team maintains the go_router package. |
it provides a simple API to handle complex routing scenarios. |
to create a new application, type flutter create <app-name>. |
to include the go_router package as a dependency, |
run flutter pub add: |
to handle the routing, create a GoRouter object in the main.dart file: |
<code_start> |
import 'package:flutter/material.dart'; |
import 'package:go_router/go_router.dart'; |
void main() => runApp(MaterialApp.router(routerConfig: router)); |
/// this handles '/' and '/details'. |
final router = GoRouter( |
routes: [ |
GoRoute( |
path: '/', |
builder: (_, __) => scaffold( |
appBar: AppBar(title: const Text('Home screen')), |
), |
routes: [ |
GoRoute( |
path: 'details', |
builder: (_, __) => scaffold( |
appBar: AppBar(title: const Text('Details screen')), |
), |
), |
], |
), |
], |
); |
<code_end> |
<topic_end> |
<topic_start> |
2. adjust iOS build settings |
navigate to the info plist file in the ios/Runner folder. |
update the key to FlutterDeepLinkingEnabled with a boolean value set to YES. |
info note |
the FlutterDeepLinkingEnabled property opts into flutter’s default deeplink handler. if |
you are using the third-party plugins, such as uni_links, setting this property will |
break these plugins. skip this step if you prefer to use third-party plugins. |
click associated domains. |
enter applinks:<web domain>. replace <web domain> with your own domain name. |
you have finished configuring the application for deep linking. |
<topic_end> |
<topic_start> |
3. hosting apple-app-site-association file |
you need to host an apple-app-site-association file in the web domain. |
this file tells the mobile browser which iOS application to open instead of the browser. |
to create the file, get the app ID of the flutter app you created in the previous step. |
<topic_end> |
<topic_start> |
app ID |
apple formats the app ID as <team id>.<bundle id>. |
for example: given a team ID of S8QB4VV633 |
and a bundle ID of com.example.deeplinkCookbook, the app ID is |
S8QB4VV633.com.example.deeplinkCookbook. |
<topic_end> |
<topic_start> |
apple-app-site-association |
the hosted file should have the following content: |
set the appID value to <team id>.<bundle id>. |
set the paths value to ["*"]. |
the paths field specifies the allowed universal links. |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.