I need to dynamically create a List variable depending on the situation.
I have a List of strings. These were created dynamically.
List Categories = [name: 'String 1', name: 'String 2', name: 'String 3']
I need to create a List variable dynamically that can hold EACH string. Don't ask me why, but trust me.
I need something like this:
for(int i = 0 ; i < Categories.length ; i ++)
{
// logic to create a variable of List type and even name it according to the value it is holding:
List String1Var = Categories.[i].name
// or even better :
List $Categories.[i].name = ....
}
so String1Var needs to be named as String1Var - i.e. the name itself has to be dynamic, and the contents too.
Is this possible in flutter?? Or have Google still yet to advance their language so it works for people like me?
Is that the right syntax? How do I dynamically create a variable name?