@override
Widget build(BuildContext context) {
return WillPopScope(
onWillPop: () async {
await _stop(); // Stop the speech when the back button is pressed
return true;
},
child: Scaffold (...),
);
}
The flutter code block of mine (above) shows the warning though it’s working but I want to migrate to the recommended approach. Please help me to solve this issue as I can not migrate to the recommended approach. I am having trouble with that. Android Studio message is shown below:
I’ve tried but found errors.
2
Answers
My solution that worked perfectly: