7

I receive a firebase dynamic link in initState.

This works great if the app is completely off. But if the app was running before clicking the link, initState is not called again, thus the dynamiclink is not processed.

Should I try to process the firebase dynamic link through WidgetsBindingObserver (for a similar effect to onResume in Android)? If not, what would be the proper way?

2 Answers 2

2

I had the same problem and I solved using WidgetsBindingObserver to listen when the app is foreground, but I found an issue on iOS.

I wrote a post about it, you can check it:

https://medium.com/@diegoveloper/flutter-firebase-dynamic-link-6f1b79278ce0

Sign up to request clarification or add additional context in comments.

5 Comments

Wow, that fixes ALL my issues! I had the link always there bug as well. THANK you for this!
don't forget to clap my Medium post :D , just saying
Is it safe to just change the pubspec file to the git? Is there any cleanup necessary before I do the switch or will that all be automatic?
it should be temporal until they accept the pull request, flutter clean / flutter packages get
Can you please help me with the question at stackoverflow.com/questions/58481840/…
0

Just like .getInitialLink() there is an onLink() listener now.

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

      if (deepLink != null) {
        // Process your deeplink
      }
    },
    onError: (OnLinkErrorException e) async {}
);

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.