uni_links
uni_links copied to clipboard
When app is killed and open from the link then initial link concept is not working
This is My Method :
initPlatformStateForStringUniLinks() async {
// Attach a listener to the links stream
_sub = getLinksStream().listen((String link) {
if (!mounted) return;
setState(() {
_latestLink = link ?? 'Unknown';
print("Latest Link : $_latestLink");
_latestUri = null;
try {
if (link != null) {
_latestUri = Uri.parse(link);
if (_latestLink.contains("lead-details")) {
print("Lead Detail");
leadID = _latestUri.pathSegments.elementAt(1);
if (AppConfig.of(context).userModel.rememberDigest.isNotEmpty) {
navigatorKey.currentState.push(new MaterialPageRoute(
builder: (BuildContext context) {
return new LeadDetailsScreen(
leadId: leadID,
isFromDeepLinking: true,
);
},
));
}
}
}
} on FormatException {}
});
}, onError: (err) {
if (!mounted) return;
setState(() {
_latestLink = 'Failed to get latest link: $err.';
_latestUri = null;
});
});
}
==
And initPlatformStateForStringUniLinks() this method called in initstate() in main.dart file
Any updates on this issue?
We also need this to be fixed asap !
@rajatjain2802 you don't seem to be using getInitialLink
nor getInitialUri
... the stream is for future links, while an app instance is already running in the background (or the foreground).
I was facing the same issue when tapping a Push notification resulted in cold-starting the iOS application, not sure this is what you're facing, but check how I fixed mine here #129