Reputation:
i need to program the back arrow on the device, but this error occurs.
the code of WillPopScope: body: WillPopScope( onWillPop: back(context), => error ),
back function is:
Future<bool> back(BuildContext context) async {
Navigator.of(context).pop();
return true;
}
Upvotes: 0
Views: 228
Reputation: 14885
As per your requirnment you will click on back arrow and go to the previous screen so try below code hope it help to you.
IconButton(
icon: Icon(Icons.arrow_back),
onPressed: () => Navigator.pop(context, false),
),
Upvotes: 0
Reputation: 2077
change
onWillPop: back(context),
to
onWillPop: () async => await back(context),
Upvotes: 1