I am using Link on Home Page where I am calling a function in initState and it working fine issue is when I move to new Page and back to page again where deep function call it call again to move to Deep link page again I want to control this and want to know how i can manage this.
Future initUniLinks() async {
// Platform messages may fail, so we use a try/catch PlatformException.
try {
String? initialLink = await getInitialLink();
//String aapLink = "https://beta.bopnhop.com?event=34&status=1";
if (initialLink != null) {
print('Link is:' + initialLink);
//Uri uri = Uri.dataFromString(initialLink);
print(Uri.parse(initialLink).queryParameters['']);
String? status = Uri.parse(initialLink).queryParameters['status'];
String? id = Uri.parse(initialLink).queryParameters['id'];
if (status == "1") {
print('status is: ${status}');
print('id is: ${id}');
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => PostHomeCommentsDetailScreen(
articleId: int.parse(id!),
),
),
);
}
}
} on PlatformException {
// Handle exception by warning the user their action did not succeed
print('Deep Link issue!');
}
I am using Link on Home Page where I am calling a function in initState and it working fine issue is when I move to new Page and back to page again where deep function call it call again to move to Deep link page again I want to control this and want to know how i can manage this.
Code that I am using is.
@override void initState() { super.initState(); initUniLinks(); }
Future initUniLinks() async {
// Platform messages may fail, so we use a try/catch PlatformException.
try {
String? initialLink = await getInitialLink();
}