I want to know the execution in case of Map.
void main(){
var info = userInfo(); /* what can I pass here as args? */
print(info);
}
userInfo(Map user){
/* what do I write here? */
}
hi there you can pass a map and use the map as follow
void main(){
Map user_map=
{
"first_name" : "fname",
"last_name" : "lname",
"gender" : "male",
"location" :
{ "state" : "state",
"country" : "country",
"place" : "place"
}
}
var info = userInfo(user_map); /* what can I pass here as args? */
print(info);
}
userInfo(Map user){
/* here you can use the map values like if you want to print the value of key
first_name */
print(user["first_name"]);
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.