Created
October 17, 2019 00:41
-
-
Save ThinkDigitalSoftware/daad02b4d63342e05e12daa615150caf to your computer and use it in GitHub Desktop.
multiple maps example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void main() async { | |
print(people); | |
print("Changing color to light Blue"); | |
colors[1] = 'Light Blue'; | |
print(people); | |
} | |
class Person{ | |
String name; | |
int colorIndex; | |
Person({this.name, this.colorIndex}); | |
toString()=> "Person{name: $name, color: ${colors[colorIndex]}}"; | |
} | |
List<Person> people = [Person(name: "Jon", colorIndex:1)]; | |
Map<int, String> colors = {1: 'Blue', 2: 'Red'}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment