我正在使用 firebase_dynamic_links:^ 0.5.0 + 11 我创建了firebase动态链接,我可以将我的应用启动到动态链接(https://myapp.page.link/test),我正在尝试阅读 deepLink.path ,但在Android和Ios中为空(不为null)。
void initState() {
super.initState();
initDynamicLinks();
}
void initDynamicLinks() async {
final PendingDynamicLinkData data =
await FirebaseDynamicLinks.instance.getInitialLink();
final Uri deepLink = data?.link;
print("---initDynamicLinks");
if (deepLink != null) {
toast("---deeplink---"+deepLink.path);
print(deepLink.path);
}
FirebaseDynamicLinks.instance.onLink(
onSuccess: (PendingDynamicLinkData dynamicLink) async {
final Uri deepLink = dynamicLink?.link;
print('--onLinkSuccess');
if (deepLink != null) {
toast("---deeplink---"+deepLink.path);
print(deepLink.path);
}
}, onError: (OnLinkErrorException e) async {
print('onLinkError');
print(e.message);
});
}
扑打医生:
[✓] Flutter (Channel stable, v1.12.13+hotfix.9, on Mac OS X 10.15.4 19E266, locale tr-TR)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 11.4)
[!] Android Studio (version 3.4)
✗ Flutter plugin not installed; this adds Flutter specific functionality.
✗ Dart plugin not installed; this adds Dart specific functionality.
[✓] VS Code (version 1.44.0)
[✓] Connected device (1 available)
答案 0 :(得分:2)
实际上,我们可以处理实际的链接路径。在我的情况下,我的deeplink mylink.page.link/test真实链接mypage.com并非如此。我将实际链接更改为:mypage.com/test,然后处理“测试”值
答案 1 :(得分:0)