handleDynamicLinks method
Implementation
Future handleDynamicLinks() async {
bool gotIosLink = false;
if (await _deviceInfoService!.isIOS13) {
await initUniLinks();
}
if (!gotIosLink) {
// 1. Get the initial dynamic link if the app is opened with a dynamic link
final PendingDynamicLinkData? data =
await FirebaseDynamicLinks.instance.getInitialLink();
// 2. handle link that has been retrieved
final Uri? deepLink = data?.link;
_handleDeepLink(deepLink);
}
// 3. Register a link callback to fire if the app is opened up from the background
// using a dynamic link.
FirebaseDynamicLinks.instance.onLink.listen((dynamicLinkData) {
_handleDeepLink(dynamicLinkData.link);
}, onError: (e) async {
print('Link Failed: ${e.message}');
});
}