I'm working on a flutter project that covers multiple platforms. My app has a payment api, which also has a callback url that sends some url parameters to my result screen. The url for my payment result screen is https://myapp.com/payment-result. I'd like to read the parameters of my call back url, which are: https://myapp.com/payment-result/?status=20&amount=2 This url, on the other hand, always restarts my web application and takes me to the first page of the app.
this is my payment result screen :
class PaymentResult extends StatelessWidget {
static const routeName = '/payment-result';
@override
Widget build(BuildContext context) {
final args = ModalRoute.of(context)!.settings.arguments as Map;
bool shouldPop = true;
return WillPopScope(
onWillPop: () async {
Navigator.of(context).popAndPushNamed('tab-screen');
return shouldPop;
},
child: Scaffold(
body: kIsWeb ? WebWidget(args:args): MobileWidget(args: args),
),
);
}
}
and I managing my routs on main widget like this :
routes: {
SelectPlan.routName: (ctx) => SelectPlan(),
MealDetails.routeName: (ctx) => MealDetails(),
AuthScreen.routeName: (ctx) => AuthScreen(),
PaymentResult.routeName: (ctx) => DailyDetails(),
SelectSub.routeName: (ctx) => SelectSub(),
OrderScreen.routName: (ctx) => OrderScreen(),