Recently i was working on intergrating my json value to the flutter design and i came across an error of
type ‘_Map<String, Object>’ is not a subtype of type ‘int’ in type cast
and i don’t know why am i having this error, can somebody explain this and give me ideas to rectify it ,thank you.
codes:
GestureDetector(
onTap: () {
Navigator.pushNamed(
context,
confirmation,
arguments: {
'itemCount': _itemCount,
'product': widget.product,
},
);
},
_itemcount is an integer value and widget.product is a list value of a data model
final int itemCount;
final Product product;
const Previewpage({super.key, required this.itemCount, required this.product});
this is page code that i want to get value for that code of navigator
case preview: // Use the constant from constants.dart
final count = settings.arguments as int;
final product = settings.arguments as Product;
return MaterialPageRoute(
builder: (context) => Previewpage(
itemCount: count,
product: product,
),
);
This is route generator code that also pass arguments.
can somebody help me with this and also explain me why we use a route generator for routing.
I think it off like a gate keeper to another widget when wanted to pass values sort of double confirmation.That’s all