I'm trying to read a dynamic link that I created on firebase inside my flutter application, I did all the configuration but I'm always getting null as a value.
Here is my firebase config:
Shortlink: https://******.page.link/test
Dynamic link: https://*******.tn/restaurant?id=64fdf73f3ac564fe091a22e6
my android manifest file code:
<meta-data
android:name="flutter_deeplinking_enabled"
android:value="true"/>
<intent-filter android:autoVerify="true">
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<data android:scheme="https" />
<data android:host="******.page.link" />
</intent-filter>
And here is how i'm trying to read the dynamic link:
Future<void> initDynamicLinks() async {
print("Initial DynamicLinks");
FirebaseDynamicLinks dynamicLinks = FirebaseDynamicLinks.instance;
dynamicLinks.onLink.listen((dynamicLinkData) {
final Uri uri = dynamicLinkData.link;
final queryParams = uri.queryParameters;
if (queryParams.isNotEmpty) {
print("Incoming Link :" + uri.toString());
} else {
print("No Current Links");
}
});
PendingDynamicLinkData? data = await dynamicLinks
.getDynamicLink(Uri.parse("https://******.page.link/test"));
final Uri uri = data!.link;
if (uri != null) {
print("Found The Searched Link: " + uri.toString());
} else {
print("Search Link Not Found");
}
}
and this is my main function:
void main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
initDynamicLinks();
}
It doesn't return me anything and actually it does not listen to any links, note that i'm running it on an android physical device on debug mode. Thanks for your help!