Get access to an object's property using bracket notation in dart


I try to do the following:

var properties = ["height" , "width"];
for (var prop in properties){[prop] =[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 ?


You can use the getPropertyValue and setProperty methods like,;

Answered By – Günter Zöchbauer

Answer Checked By – Mary Flores (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published. Required fields are marked *