flutter onwillpop navigate to home code example
Example: flutter willpopscope return value
final return = Navigator.of(context).push(MaterialPageRoute<bool>(
builder: (BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("New Page"),
),
body: WillPopScope(
onWillPop: () {
Navigator.pop(context, false);
return new Future(() => false);
},
child: newPageStuff(),
),
);
},
));