Skip to content

Instantly share code, notes, and snippets.

@hernandazevedo
Created March 29, 2019 12:53
Show Gist options
  • Save hernandazevedo/f0a47d0506f87d03edc3c596305bd8c3 to your computer and use it in GitHub Desktop.
Save hernandazevedo/f0a47d0506f87d03edc3c596305bd8c3 to your computer and use it in GitHub Desktop.
void main() {
Carro c1 = Carro("Fusca");
Carro c2 = Carro("Brasilia");
Carro c3 = Carro("Chevete");
final carros = {1:c1 ,2: c2};
carros[3] = c3;
print ("Lista $carros");
for(var id in carros.keys) {
final c = carros[id];
print(">> ${c.nome}");
}
}
class Carro {
String nome;
Carro(this.nome);
String toString() {
return nome;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment