enzou
enzou

Reputation: 316

Access to particular item in a List<Map> in Dart

how can I access to a particular item in a List <Map> with Dart?.. Doing an analogy with JS it's would be something like arrayObject[0].atribObject... Example

I need to show the value of name atrib from 2nd object

List<Map> arrayObjects = [{"name":"Map1"},{"name":"Map2"}];

Upvotes: 2

Views: 172

Answers (1)

chinloyal
chinloyal

Reputation: 1141

Well since it's a list of maps the correct syntax would be:

List<Map> arrayObjects = [{"name":"Map1"},{"name":"Map2"}];

print(arrayObjects[1]["name"]);

Upvotes: 2

Related Questions