I try to do the following:
var properties = ["height" , "width"];
for (var prop in properties){
div.style[prop] = otherdiv.style[prop];
}
But dart doesn't seem to accept this bracket notation, is there any other way to access a property using a string in dart ?
Günter Zöchbauer
You can use the getPropertyValue
and setProperty
methods like
div.style.setProperty(prop, otherdiv.style.getPropertyValue(prop));
来源:https://stackoverflow.com/questions/28262768/get-access-to-an-objects-property-using-bracket-notation-in-dart