1

I builed a flutter app where there is two pages,one have a CarouselSlider of containers in a RaisedButton widget ,and when i click on an image it pushes another page whith this image,when i try to go back to the previous page i get this error:Error image

i tryed : 1- making the onpressed function in the CarouselSlider page an asynchrones function and put an await key word before the Navigation instruction 2- setState after the Navigation instruction

onPressed: () async {
      Navigator.pushNamed(context, '/music',);
      var route = new MaterialPageRoute(builder: (BuildContext context)=>new Music(imagePath: _imgPath));
      await Navigator.of(context).push(route);
      setState(() {});
                     }
Code Poet
  • 6,222
  • 2
  • 29
  • 50

0 Answers0