Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /* Write a Dart function that takes two lists of equal length, one with keys and one with values, and returns a map created from these lists. */
- void main() {
- List<String> keys = ['name','age','city'];
- List<dynamic> values =['Alice',25,'New York'];
- print(merging(keys,values));
- }
- Map<String,dynamic> merging(List<String> k,List<dynamic> v)
- {
- Map<String,dynamic> abc = {};
- for(int i=0;i<k.length;i++)
- {
- abc[k[i]]=v[i];
- }
- return abc;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement