Flutterfire: [dynamic_link] Support for ofl parameter

Created on 11 Feb 2020  路  2Comments  路  Source: FirebaseExtended/flutterfire

Is your feature request related to a problem? Please describe.
Currently, there's no way to specify the ofl parameter in the dynamic link. This is helpful when the linked content does not have a web equivalent, thus we need to set a different URL for desktop users.

Describe the solution you'd like
Add a desktopLink for DynamicLinkParameters

Additional context
For reference: https://firebase.google.com/docs/dynamic-links/create-manually?authuser=0

dynamic_links enhancement

Most helpful comment

I found this issue recently and I figure out a half-way workaround that can help to mitigate the issue. You create the dynamic link as it is specified and then modify the "queryParameters":

// WORKAROUND to add ofl parameter (fallback on desktop browser not yet implemented on FB DynamicLinks)
Uri uri = await parameters.buildUrl();
uri = uri.replace(queryParameters: Map<String, String>()..addAll(uri.queryParameters)..addAll({'ofl': YOUR_URI}));

final ShortDynamicLink dynamicUrl = await DynamicLinkParameters.shortenUrl(uri); // await parameters.buildShortLink();

All 2 comments

A possible workaround for this is to manually create a long link, specify the ofl, then generate a short link using the plugin. However, it's harder to read compared to when using DynamicLinkParameters

I found this issue recently and I figure out a half-way workaround that can help to mitigate the issue. You create the dynamic link as it is specified and then modify the "queryParameters":

// WORKAROUND to add ofl parameter (fallback on desktop browser not yet implemented on FB DynamicLinks)
Uri uri = await parameters.buildUrl();
uri = uri.replace(queryParameters: Map<String, String>()..addAll(uri.queryParameters)..addAll({'ofl': YOUR_URI}));

final ShortDynamicLink dynamicUrl = await DynamicLinkParameters.shortenUrl(uri); // await parameters.buildShortLink();
Was this page helpful?
0 / 5 - 0 ratings