How to get a list of keys of a map in dart?

Viewed 12305

I want to get a list of keys of a map in dart programming language.

I am familiar with dictionary in python and for the same objective in python there exists a direct method. I fail to find this in dart.

Is their any work around ?

1 Answers
void main() { 
   var details = {'Usrname':'tom','Password':'pass@123'}; 
   print(details.keys); \\ Gives an Iterable<String>.

   \\ And to return a true List:
   List newList = details.keys.toList();
}

(Usrname, Password)

Related