Reputation: 105
I just wanted to know how I can pass the whole list as an argument through Navigator.pushnamed() in Flutter. Is it possible or not? If I m trying to pass list n its showing The argument type 'List' cannot be assigned to 'String'
Upvotes: 0
Views: 1257
Reputation: 7941
The list that you want to pass;
List yourList = [];
pass it through the Navigator;
Navigator.pushNamed(
context,
'routeName',
arguments: yourList,
);
and get your list in target widget;
List _yourListFromArguments;
@override
void didChangeDependencies() {
_yourListFromArguments = ModalRoute.of(context).settings.arguments;
super.didChangeDependencies();
}
Upvotes: 0