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'
Asked
Active
Viewed 1,074 times
1 Answers
0
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();
}

Mehmet Ali Bayram
- 7,222
- 2
- 22
- 27