I have a mistake. I am creating a dynamic link with parameters in Firebase
. When this link comes to me and I click on it, I am transferred to the application to the desired screen. But I want to get the code
parameter
from my link which I followed but when I get this parameter I have deepLink.queryParameters['code']
- get value null
. I can deduce that the link I'm following goes without parameters. Why do link parameters disappear and how to make sure that they are not lost and you can use them?
my link
https://.../app?pageName=emailActivationPage&code=7075
code
await Firebase.initializeApp();
final PendingDynamicLinkData? initialLink =
await FirebaseDynamicLinks.instance.getInitialLink();
if (widget.initialLink != null) {
String? code;
final Uri deepLink = widget.initialLink!.link;
if (deepLink.queryParameters.containsKey('code')) {
code = deepLink.queryParameters['code'];
} else {
code = 'No code';
}
routeCubit.toForgotPasswordPage(code, true);
CodePudding user response:
Try to build short link
instead of a normal encoded dynamic link. it will work for both platforms (Andriod & iOS)
For the front end, you can build a short link like this.
final DynamicLinkParameters parameters = DynamicLinkParameters(uriPrefix:'https://example.page.link',
longDynamicLink: Uri.parse('https://example.page.link/?uid=1&id=2',),
link: Uri.parse(DynamicLink),
androidParameters: const AndroidParameters(
packageName:'com.domian.appname',
minimumVersion: 0,),
iosParameters: const IOSParameters(bundleId:'com.domian.packagename',
minimumVersion: '0',),
);
Uri url;
final ShortDynamicLink shortLink = await dynamicLinks.buildShortLink(parameters);
url = shortLink.shortUrl;
Refer following official links:
Manually create dynamic links with data. - Flutter Reference link
Manually create from your server - Rest API Reference link