app_links: ^6.3.2
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<uses-permission android:name="android.permission.INTERNET"/>
<application>
<activity>
<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="http" android:host="medexsepeti.com" android:pathPrefix="/" />
<data android:scheme="https" android:host="medexsepeti.com" android:pathPrefix="/" />
</intent-filter>
</activity>
</application>
</manifest>
class DeepLinkConfiguration {
DeepLinkConfiguration();
final appLinks = AppLinks();
StreamSubscription<Uri>? sub;
void initDeepLinkListener(context) async {
sub = appLinks.uriLinkStream.listen((uri) async {
await Future.delayed(Duration(seconds: 4));
_handleDeepLink(uri,context);
});
}
Future<void> _handleDeepLink(uri,context) async {
final productId = uri.pathSegments.last;
// Code to redirect
}
ON MAIN INIT STATE
@override
void initState() {
super.initState();
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
_deepLinkConfiguration = DeepLinkConfiguration();
_deepLinkConfiguration.initDeepLinkListener(context);
});
}
But remember you can only test deep link if you build your app with release mode, and if you publish it on playstore add playstore SHA-1
on
may be available on