Reputation: 1793
I have no clue why this is happening. When device or emulator back button is pressed, nothing happens. App bar back button is working!, implemented back button works also.
I've created a new flutter project to test this problem:
First page
Scaffold(
appBar: AppBar(
title: Text(widget.title),
),
body: Center(
child: FlatButton(
color: Colors.grey[300],
onPressed: () {
Navigator.push(
context,
MaterialPageRoute(
builder: (context) => NextPage(),
),
);
},
child: Text('next page'),
),
),
);
Second page
Scaffold(
appBar: AppBar(
title: Text('next page'),
),
body: Center(
child: FlatButton(
color: Colors.grey[300],
onPressed: () {
Navigator.pop(context);
},
child: Text('go back'),
),
),
);
Upvotes: 4
Views: 2215
Reputation: 1793
I used to be on master channel, I upgraded flutter today, and this issue came up. The solution was to change the channel to stable.
Run the command
Flutter channel stable
After it finishes run
Flutter clean
and everything should be alright.
Upvotes: 1