Reputation: 1186
I have used dynamic links in my flutter app and I create the link manually through codes through dynamic links package I have configured my link to open play store when not installed on Android and redirect to a particular website in ios and iPad but how to give a fall back link for other platforms ?
Upvotes: 0
Views: 974
Reputation: 1186
You can manually add ofl (or afl, or ifl) to the long Uri string and use it directly, or even build a short URL from it.
This code creates a DynamicLinkParameters variable parameters using the DynamicLinkParameters() constructor inside an async function, then uses it to create a short link that falls back to https://example.com on desktop:
final DynamicLinkParameters parameters = DynamicLinkParameters(
// constructor arguments
);
final Uri longLink = await parameters.buildUrl();
final ShortDynamicLink shortDynamicLink = await DynamicLinkParameters.shortenUrl(Uri.parse(longLink.toString() + "&ofl=https://example.com"));
final Uri dynamicLinkShortUrl = shortDynamicLink.shortUrl;
Upvotes: 1