I have 4 screens (home, Excursion, Spa, detail) and I want to navigate from multiple to one detailed screen (from home, Excursion, Spa to detail) it work fine at first but after it give me: type 'Null' is not a subtype of type 'String' Error, if I navigate from the "Excursion" or "Spa" page to the "Detail" page. but it work fine if I navigate from the home the detail screen. this is the Home screen
Container(
child: GestureDetector(
onTap: ()=>Navigator.pushNamed(context, '/Detail',arguments:{
'previousScreenData':dataList_home[index],
}
),
child: Card(
child: Center(
child: Column(
children:<Widget>[
Image(
image: NetworkImage(dataList_home[index]["PHOTO"]),
height: 250,
fit:BoxFit.fill,
),
SizedBox(height: 10.0),
Column(
children:<Widget>[
Text(
dataList_home[index]["LIBELLE"],
),
]
),
SizedBox(height: 10.0),
Column(
children:<Widget>[
Text(
dataList_home[index]["PRICE_AD"],
),
]
),
SizedBox(height: 10.0),
Row(
mainAxisAlignment:MainAxisAlignment.spaceEvenly,
children:<Widget>[
for ( var i in iconList ) Row(
children:<Widget>[
FaIcon(iconMapping [i.toString()] ?? FontAwesomeIcons.question,),
]
),
],
),
SizedBox(height: 15.0),
]
),
),
semanticContainer: true,
clipBehavior: Clip.antiAliasWithSaveLayer,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
elevation: 5,
margin: EdgeInsets.all(10),
),
),
);
this is the Spa screen
Container(
child: GestureDetector(
onTap: ()=>Navigator.pushNamed(context, '/Detail',arguments:{
'previousScreenData':dataList_spa[index],
}),
child: Card(
child: Center(
child: Column(
children:<Widget>[
Image(
image: NetworkImage(dataList_spa[index]["PHOTO"]),
height: 250,
fit:BoxFit.fill,
),
SizedBox(height: 10.0),
Column(
children:<Widget>[
Text(
dataList_spa[index]["LIBELLE"],
),
]
),
SizedBox(height: 10.0),
Column(
children:<Widget>[
Text(
dataList_spa[index]["PRICE_AD"],
),
]
),
SizedBox(height: 10.0),
Row(
mainAxisAlignment:MainAxisAlignment.spaceEvenly,
children:<Widget>[
for ( var i in iconList ) Row(
children:<Widget>[
FaIcon(iconMapping [i.toString()] ?? FontAwesomeIcons.question),
]
),
],
),
SizedBox(height: 15.0),
]
),
),
semanticContainer: true,
clipBehavior: Clip.antiAliasWithSaveLayer,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(10.0),
),
elevation: 5,
margin: EdgeInsets.all(10),
),
),
);
This is the Detail Screen
Widget build(BuildContext context) {
dataMap=ModalRoute.of(context)?.settings.arguments as Map;//We recieve the data as a Map from the home screen
[![enter image description here][1]][1]
[1]: https://i.stack.imgur.com/NizdG.jpg