How do you call the set function on a map's property?

Issue

Just like with other objects, you can call:

set('myKey', 44);
set('something', 'Hello World');

you can even do maps

set("myMap", new Map());

but how do i call set to notify if a map property has changed. Obviously, i cant do:

set('myMap.myProp', 'test');

can i?

im trying to update the map property for something bound to the screen, but i thought it would be silly to do something like:

Map m = myMap;
m['myProp'] = 'test';
set('myMap',m);

since it is doing a lot of work it wouldnt need to do.

This is in PolymerDart

Solution

As far as I know this

set('myMap.myProp', 'test');

should work fine to add an item to the map with key myProp and value 'test'

Answered By – Günter Zöchbauer

Answer Checked By – Clifford M. (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.