Flutter 프로젝트의 루트 디렉터리에서 다음 명령어를 실행하여 동적 링크 플러그인을 설치합니다.
flutter pub add firebase_dynamic_links
Android 앱을 빌드하는 경우 Firebase Console의 프로젝트 설정 페이지를 열고 SHA-1 서명 키를 지정했는지 확인합니다. 앱 링크를 사용하는 경우에도 SHA-256 키를 지정합니다.
플랫폼 통합
앱을 빌드할 플랫폼에 대한 다음 플랫폼 통합 단계를 완료합니다.
Android
Android에서는 앱이 설치된 경우 동적 링크가 사용자 도메인으로 리디렉션되므로 도메인의 인텐트 필터 포착 딥 링크를 새로 추가해야 합니다. 이렇게 하려면 Play 스토어에서 앱을 설치 및 업데이트하고 계속 버튼을 탭한 후 앱에서 동적 링크 데이터를 수신해야 합니다. AndroidManifest.xml:
FirebaseDynamicLinks.onLink - PendingDynamicLinkData?가 포함된 Stream을 반환하는 이벤트 핸들러입니다.
Android는 항상 종료된 상태에서 FirebaseDynamicLinks.getInitialLink를 통해 링크를 수신하지만 iOS에서는 보장되지 않습니다. 따라서 애플리케이션이 링크를 수신하도록 다음 순서로 모두 설정하는 것이 좋습니다.
Future<void>main()async{WidgetsFlutterBinding.ensureInitialized();awaitFirebase.initializeApp(options:DefaultFirebaseConfig.platformOptions);// Check if you received the link via `getInitialLink` firstfinalPendingDynamicLinkData?initialLink=awaitFirebaseDynamicLinks.instance.getInitialLink();if(initialLink!=null){finalUrideepLink=initialLink.link;// Example of using the dynamic link to push the user to a different screenNavigator.pushNamed(context,deepLink.path);}FirebaseDynamicLinks.instance.onLink.listen((pendingDynamicLinkData){// Set up the `onLink` event listener next as it may be received hereif(pendingDynamicLinkData!=null){finalUrideepLink=pendingDynamicLinkData.link;// Example of using the dynamic link to push the user to a different screenNavigator.pushNamed(context,deepLink.path);}},);runApp(MyApp(initialLink));}
그런 다음 애플리케이션 로직에서 링크가 처리되었는지 확인하고 작업을 수행할 수 있습니다. 예를 들면 다음과 같습니다.
if(initialLink!=null){finalUrideepLink=initialLink.link;// Example of using the dynamic link to push the user to a different screenNavigator.pushNamed(context,deepLink.path);}
백그라운드 / 포그라운드 상태
애플리케이션이 열려 있는 동안 또는 백그라운드에서 FirebaseDynamicLinks.onLink getter를 사용합니다.
[[["이해하기 쉬움","easyToUnderstand","thumb-up"],["문제가 해결됨","solvedMyProblem","thumb-up"],["기타","otherUp","thumb-up"]],[["필요한 정보가 없음","missingTheInformationINeed","thumb-down"],["너무 복잡함/단계 수가 너무 많음","tooComplicatedTooManySteps","thumb-down"],["오래됨","outOfDate","thumb-down"],["번역 문제","translationIssue","thumb-down"],["샘플/코드 문제","samplesCodeIssue","thumb-down"],["기타","otherDown","thumb-down"]],["최종 업데이트: 2025-09-04(UTC)"],[],[],null,["\u003cbr /\u003e\n\n| **Note:** Firebase Dynamic Links is *deprecated* and should not be used in new projects. The service will be shutting down soon. Follow the [migration guide](/support/dynamic-links-faq#how_should_i_migrate_from_the_service) and see the [Dynamic Links Deprecation FAQ](/support/dynamic-links-faq) for more information.\n\nTo receive the Firebase Dynamic Links that [you created](/docs/dynamic-links/create-links),\nyou must include the Dynamic Links SDK in your app and call the\n`FirebaseDynamicLinks.getDynamicLink()` method when your app loads to\nget the data passed in the Dynamic Link.\n\nSet up Firebase and the Dynamic Links SDK\n\n1. [Install and initialize the Firebase SDKs for Flutter](/docs/flutter/setup) if you\n haven't already done so.\n\n2. From the root directory of your Flutter project, run the following\n command to install the Dynamic Links plugin:\n\n flutter pub add firebase_dynamic_links\n\n3. If you're building an Android app, open the [Project settings](https://console.firebase.google.com/project/_/settings/general/)\n page of the Firebase console and make sure you've specified your SHA-1\n signing key. If you use App Links, also specify your SHA-256 key.\n\nPlatform integration\n\nComplete the following platform integration steps for the platforms you're\nbuilding your app for.\n\nAndroid\n\nOn Android, you must add a new intent filter catch deep links of your domain, since the\nDynamic Link will redirect to your domain if your app is installed. This is required for your app to\nreceive the Dynamic Link data after it is installed/updated from the Play Store and one taps on\nContinue button. In `AndroidManifest.xml`: \n\n \u003cintent-filter\u003e\n \u003caction android:name=\"android.intent.action.VIEW\"/\u003e\n \u003ccategory android:name=\"android.intent.category.DEFAULT\"/\u003e\n \u003ccategory android:name=\"android.intent.category.BROWSABLE\"/\u003e\n \u003cdata\n android:host=\"example.com\"\n android:scheme=\"https\"/\u003e\n \u003c/intent-filter\u003e\n\nWhen users open a Dynamic Link with a deep link to the scheme and host you specify, your app will\nstart the activity with this intent filter to handle the link.\n\nThe next step is to ensure the SHA-256 fingerprint of the signing certificate is registered in the Firebase console\nfor the app. You can find more details on how to retrieve your SHA-256 fingerprint on the\n[Authenticating Your Client](https://developers.google.com/android/guides/client-auth) page.\n\nApple platforms\n\n1. [Create an Apple developer account](https://developer.apple.com/programs/enroll/)\n if you don't already have one.\n\n2. On the [Project settings](https://console.firebase.google.com/project/_/settings/general/)\n page of the Firebase console, ensure that your iOS app is correctly\n configured with your App Store ID and Team ID.\n\n3. On the Apple Developer site, create a provisioning profile for your app\n with the Associated Domain capability enabled.\n\n4. In Xcode, do the following:\n\n 1. Open your app under the **TARGETS** header.\n\n 2. On the Signing \\& Capabilities page, ensure your Team is registered, and\n your Provisioning Profile is set.\n\n 3. On the Signing \\& Capabilities page, enable **Associated Domains** and\n add the following to the Associated Domains list (replace example with your domain):\n\n applinks:example.page.link\n\n 4. On the Info page, add a URL Type to your project. Set the URL Schemes\n field to your app's bundle ID. (The Identifier can be `Bundle ID` or\n whatever you wish.)\n\n 5. If you have set up a custom domain for your Firebase project, add the\n Dynamic Link URL prefix into your iOS project's `Info.plist` file\n using the `FirebaseDynamicLinksCustomDomains` key.\n\n \u003c?xml version=\"1.0\" encoding=\"UTF-8\"?\u003e\n \u003c!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"\u003e\n \u003cplist version=\"1.0\"\u003e\n \u003cdict\u003e\n \u003ckey\u003eFirebaseDynamicLinksCustomDomains\u003c/key\u003e\n \u003carray\u003e\n \u003cstring\u003ehttps://custom.domain.io/path1\u003c/string\u003e\n \u003cstring\u003ehttps://custom.domain.io/path2\u003c/string\u003e\n \u003c/array\u003e\n\n ...other settings\n\n \u003c/dict\u003e\n \u003c/plist\u003e\n\n 6. **Optional:** Disable the Dynamic Links SDK's use of the iOS pasteboard.\n\n By default, the Dynamic Links SDK uses the pasteboard to improve the\n reliability of post-install deep links. By using the pasteboard, Dynamic\n Links can make sure that when a user opens a Dynamic Link but needs to\n install your app first, the user can go immediately to the original\n linked content when opening the app for the first time after\n installation.\n\n The downside of this is that use of the pasteboard triggers a\n notification on iOS 14 and later. So, the first time users open your\n app, if the pasteboard contains a Dynamic Link URL, they will see a\n notification that your app accessed the pasteboard, which can cause\n confusion.\n\n To disable this behavior, edit your Xcode project's `Info.plist` file\n and set the `FirebaseDeepLinkPasteboardRetrievalEnabled` key to `NO`.\n | **Note:** When you disable this feature, the Dynamic Links you receive will have a `matchType` of `weak` at best. Adjust your app's logic accordingly.\n\nHandle deep links\n\nTo handle a Dynamic Link in your application, two scenarios require implementing.\n| **Warning:** You may have unexpected results if you have enabled Flutter deep linking in your app. See [Migrating from plugin-based deep linking](https://docs.flutter.dev/development/ui/navigation/deep-linking#migrating-from-plugin-based-deep-linking). This [GitHub issue](https://github.com/firebase/flutterfire/issues/9469) illustrates what you ought to be aware of.\n\nTerminated State\n\nSet up the following methods:\n\n1. `FirebaseDynamicLinks.getInitialLink` - returns a `Future\u003cPendingDynamicLinkData?\u003e`\n2. `FirebaseDynamicLinks.onLink` - event handler that returns a `Stream` containing a `PendingDynamicLinkData?`\n\nAndroid will always receive the link via `FirebaseDynamicLinks.getInitialLink` from a terminated state,\nbut on iOS, it is not guaranteed. Therefore, it is worth setting them both up in the following order\nto ensure your application receives the link: \n\n Future\u003cvoid\u003e main() async {\n WidgetsFlutterBinding.ensureInitialized();\n await Firebase.initializeApp(options: DefaultFirebaseConfig.platformOptions);\n\n // Check if you received the link via `getInitialLink` first\n final PendingDynamicLinkData? initialLink = await FirebaseDynamicLinks.instance.getInitialLink();\n\n if (initialLink != null) {\n final Uri deepLink = initialLink.link;\n // Example of using the dynamic link to push the user to a different screen\n Navigator.pushNamed(context, deepLink.path);\n }\n\n FirebaseDynamicLinks.instance.onLink.listen(\n (pendingDynamicLinkData) {\n // Set up the `onLink` event listener next as it may be received here\n if (pendingDynamicLinkData != null) {\n final Uri deepLink = pendingDynamicLinkData.link;\n // Example of using the dynamic link to push the user to a different screen\n Navigator.pushNamed(context, deepLink.path);\n }\n },\n );\n\n runApp(MyApp(initialLink));\n }\n\nWithin your application logic, you can then check whether a link was handled and perform an action, for example: \n\n if (initialLink != null) {\n final Uri deepLink = initialLink.link;\n // Example of using the dynamic link to push the user to a different screen\n Navigator.pushNamed(context, deepLink.path);\n }\n\nBackground / Foreground State\n\nWhilst the application is open, or in the background, use the `FirebaseDynamicLinks.onLink`\ngetter: \n\n FirebaseDynamicLinks.instance.onLink.listen((dynamicLinkData) {\n Navigator.pushNamed(context, dynamicLinkData.link.path);\n }).onError((error) {\n // Handle errors\n });\n\nAlternatively, if you wish to identify if an exact Dynamic Link was used to open the application, pass it to\nthe `getDynamicLink` method instead: \n\n String link = 'https://\u003cvar translate=\"no\"\u003edynamic-link-domain\u003c/var\u003e/ke2Qa';\n\n final PendingDynamicLinkData? initialLink = await FirebaseDynamicLinks.instance.getDynamicLink(Uri.parse(link));\n\nTesting A Dynamic Link On iOS Platform\n\nTo test a dynamic link on iOS, it is required that you use an actual device. You will also need to run the app in release mode (i.e. `flutter run --release`.),\nif testing a dynamic link from a terminated (i.e. app has been swiped closed.) app state."]]