firebase_dynamic_links 0.5.0+9

  • Readme
  • Changelog
  • Example
  • Installing
  • 99

Google Dynamic Links for Firebase #

pub package

A Flutter plugin to use the Google Dynamic Links for Firebase API.

With Dynamic Links, your users get the best available experience for the platform they open your link on. If a user opens a Dynamic Link on iOS or Android, they can be taken directly to the linked content in your native app. If a user opens the same Dynamic Link in a desktop browser, they can be taken to the equivalent content on your website.

In addition, Dynamic Links work across app installs: if a user opens a Dynamic Link on iOS or Android and doesn't have your app installed, the user can be prompted to install it; then, after installation, your app starts and can access the link.

For Flutter plugins for other Firebase products, see

Usage #

To use this plugin, add firebase_dynamic_links as a dependency in your pubspec.yaml file. You must also configure firebase dynamic links for each platform project: Android and iOS (see the example folder or for step by step details).

You create a Dynamic Link either by using the Firebase console, using a REST API, iOS or Android Builder API, Flutter API, or by forming a URL by adding Dynamic Link parameters to a URI prefix specific to your app. These parameters specify the links you want to open, depending on the user's platform and whether your app is installed.

Below are instructions to create Dynamic Links using Flutter with the Firebase Dynamic Links API. This API accepts either a long Dynamic Link or an object containing Dynamic Link parameters, and returns a URL like the following example:

You can create a Dynamic Link programmatically by setting the following parameters and using the DynamicLinkParameters.buildUrl() method.

final DynamicLinkParameters parameters = DynamicLinkParameters(
  uriPrefix: '',
  link: Uri.parse(''),
  androidParameters: AndroidParameters(
      packageName: '',
      minimumVersion: 125,
  iosParameters: IosParameters(
      bundleId: 'com.example.ios',
      minimumVersion: '1.0.1',
      appStoreId: '123456789',
  googleAnalyticsParameters: GoogleAnalyticsParameters(
      campaign: 'example-promo',
      medium: 'social',
      source: 'orkut',
  itunesConnectAnalyticsParameters: ItunesConnectAnalyticsParameters(
    providerToken: '123456',
    campaignToken: 'example-promo',
  socialMetaTagParameters:  SocialMetaTagParameters(
    title: 'Example of a Dynamic Link',
    description: 'This link works whether app is installed or not!',

final Uri dynamicUrl = await parameters.buildUrl();

To create a short Dynamic Link, build DynamicLinkParameters the same way, but use the DynamicLinkParameters.buildShortLink() method.

final ShortDynamicLink shortDynamicLink = await parameters.buildShortLink();
final Uri shortUrl = shortDynamicLink.shortUrl;

To shorten a long Dynamic Link, use the DynamicLinkParameters.shortenUrl method.

final ShortDynamicLink shortenedLink = await DynamicLinkParameters.shortenUrl(

final Uri shortUrl = shortenedLink.shortUrl;

You can receive a Dynamic Link containing a deep link that takes the user to specific content within your app:

  1. In the Firebase Console, open the Dynamic Links section.
  • Accept the terms of service if you are prompted to do so.
  • Take note of your project's Dynamic Links URL prefix, which is displayed at the top of the Dynamic Links page. You need your project's Dynamic Links URL prefix to programmatically create Dynamic Links. A Dynamic Links URL prefix looks like

Receiving dynamic links on iOS requires a couple more steps than Android. If you only want to receive dynamic links on Android, skip to step 4. You can also follow a video on the next two steps here.

  1. In the Info tab of your iOS app's Xcode project:
  • Create a new URL Type to be used for Dynamic Links.
  • Set the Identifier field to a unique value and the URL Schemes field to be your bundle identifier, which is the default URL scheme used by Dynamic Links.
  1. In the Capabilities tab of your app's Xcode project, enable Associated Domains and add the following to the Associated Domains list:
  1. To receive a dynamic link, call the getInitialLink() method from FirebaseDynamicLinks which gets the link that opened the app (or null if it was not opened via a dynamic link) and configure listeners for link callbacks when the application is active or in background calling onLink.
void main() {
    title: 'Dynamic Links Example',
    routes: <String, WidgetBuilder>{
      '/': (BuildContext context) => MyHomeWidget(), // Default home route
      '/helloworld': (BuildContext context) => MyHelloWorldWidget(),

class MyHomeWidgetState extends State<MyHomeWidget> {
  void initState() {

  void initDynamicLinks() async {
    final PendingDynamicLinkData data = await FirebaseDynamicLinks.instance.getInitialLink();
    final Uri deepLink = data?.link;

    if (deepLink != null) {
      Navigator.pushNamed(context, deepLink.path);

      onSuccess: (PendingDynamicLinkData dynamicLink) async {
        final Uri deepLink = dynamicLink?.link;

        if (deepLink != null) {
          Navigator.pushNamed(context, deepLink.path);
      onError: (OnLinkErrorException e) async {

If your app did not open from a dynamic link, getInitialLink() will return null.

Getting Started #

See the example directory for a complete sample app using Google Dynamic Links for Firebase.

Issues and feedback #

Please file Flutterfire specific issues, bugs, or feature requests in our issue tracker.

Plugin issues that are not specific to Flutterfire can be filed in the Flutter issue tracker.

To contribute a change to this plugin, please review our contribution guide, and send a pull request.

0.5.0+9 #

  • Remove the deprecated author: field from pubspec.yaml
  • Migrate the plugin to the pubspec platforms manifest.
  • Bump the minimum Flutter version to 1.10.0.

0.5.0+8 #

  • Support v2 embedding. This will remain compatible with the original embedding and won't require app migration.

0.5.0+7 #

  • Add getDynamicLink to support expanding from short links.

0.5.0+6 #

  • Updated README instructions for contributing for consistency with other Flutterfire plugins.

0.5.0+5 #

  • Remove AndroidX warning.

0.5.0+4 #

  • Fix example app build by updating version of url_launcher that is compatible with androidx apps.

0.5.0+3 #

  • Don't crash if registrar.activity() is not there.

0.5.0+2 #

  • Change the OnLinkError object to be a real exception.

0.5.0+1 #

  • Update documentation to reflect new repository location.
  • Update unit tests to call TestWidgetsFlutterBinding.ensureInitialized.

0.5.0 #

  • Breaking change. Changed architecture and method names to be able to differentiate between the dynamic link which opened the app and links clicked during app execution (active and background). retrieveDynamicLink has been replaced with two different functions:
  • getInitialLink a future to retrieve the link that opened the app
  • onLink a callback to listen to links opened while the app is active or in background

0.4.0+6 #

  • Update google-services Android gradle plugin to 4.3.0 in documentation and examples.

0.4.0+5 #

  • Fix the bug below properly by allowing the activity to be null (but still registering the plugin). If activity is null, we don't get a latestIntent, instead we expect the intent listener to grab it.

0.4.0+4 #

  • Fixed bug on Android when a headless plugin tries to register this plugin causing a crash due no activity from the registrar.

0.4.0+3 #

  • Automatically use version from pubspec.yaml when reporting usage to Firebase.

0.4.0+2 #

  • Add missing template type parameter to invokeMethod calls.
  • Bump minimum Flutter version to 1.5.0.
  • Replace invokeMethod with invokeMapMethod wherever necessary.

0.4.0+1 #

  • Fixed bug where link persists after starting an app with a Dynamic Link.
  • Fixed bug where retrieving a link would fail when app was already running.

0.4.0 #

  • Update dependency on firebase_core to 0.4.0.

0.3.0. #

  • Update Android dependencies to 16.1.7.
  • Breaking change. Dynamic link parameter domain replaced with uriPrefix.

0.2.1 #

  • Throw PlatformException if there is an error retrieving dynamic link.

0.2.0+4 #

  • Fix crash when receiving ShortDynamicLink warnings.

0.2.0+3 #

  • Log messages about automatic configuration of the default app are now less confusing.

0.2.0+2 #

  • Remove categories.

0.2.0+1 #

  • Log a more detailed warning at build time about the previous AndroidX migration.

0.2.0 #

  • Breaking change. Migrate from the deprecated original Android Support Library to AndroidX. This shouldn't result in any functional changes, but it requires any Android apps using this plugin to also migrate if they're using the original support library.

0.1.1 #

  • Update example to create a clickable and copyable link.

0.1.0+2 #

  • Change android invites dependency to dynamic links dependency.

0.1.0+1 #

  • Bump Android dependencies to latest.

0.1.0 #

  • Breaking Change Calls to retrieve dynamic links on iOS always returns null after first call.

0.0.6 #

  • Bump Android and Firebase dependency versions.

0.0.5 #

  • Added capability to receive dynamic links.

0.0.4 #

  • Fixed dynamic link dartdoc generation.

0.0.3 #

  • Fixed incorrect homepage link in pubspec.

0.0.2 #

  • Updated Gradle tooling to match Android Studio 3.1.2.

0.0.1 #

  • Initial release with api to create long or short dynamic links.


firebase_dynamic_links_example #

Demonstrates how to use the firebase_dynamic_links plugin.

Important #

The example app for this plugin only receives links on Android. Xcode has signing requirements that must be configured with an iOS app developer team id. Check the firebase_dynamic_links/ for more details.

Getting Started #

For help getting started with Flutter, view our online documentation.

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:

  firebase_dynamic_links: ^0.5.0+9

2. Install it

You can install packages from the command line:

with Flutter:

$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:

import 'package:firebase_dynamic_links/firebase_dynamic_links.dart';
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

We analyzed this package on Jan 24, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.0
  • pana: 0.13.4
  • Flutter: 1.12.13+hotfix.5


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11 1.14.12
meta 1.1.8
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
e2e ^0.2.1
firebase_core ^0.4.0
url_launcher ^4.2.0