When we use below code after flutter version 3.12.0 we are getting deprecated message, what to use insted of this now?
WillPopScope(
onWillPop: () {
setStatusBarColor(statusBarColorPrimary,statusBarIconBrightness: Brightness.light);
finish(context);
return Future.value(true);
},)
WillPopScope is deprecated after flutter v3.12.0-1.0.pre.
Now you can use PopScope as below:
return PopScope(
canPop: true, //When false, blocks the current route from being popped.
onPopInvoked: (didPop) {
//do your logic here:
setStatusBarColor(
statusBarColorPrimary,
statusBarIconBrightness: Brightness.light,
);
finish(context);
},
child: Scaffold(/*other child and ui etc*/),
);
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With