Reputation: 1869
var stars = new Map<String,Map<String,String>>();
Map<String,String> xx = {
'test' : 'test'
};
stars.putIfAbsent('String', xx);
im getting this error the argument type Map<String,String> cant be assigned to the parameter type Map<String,String>Function()
,
i don't know what's this Function()
at the end of the map, i know this maybe a stupid question but i really dont know where to read about it because i found nothing helpful at official dart docs . thanks in advance
Upvotes: 0
Views: 172
Reputation: 8714
putIfAbsent
requires the 2nd parameter to be a function, not a value. Try this code:
stars.putIfAbsent('String', () => xx);
Upvotes: 2