Skip to content

Instantly share code, notes, and snippets.

@felipecastrosales
Created November 12, 2021 01:19
Show Gist options
  • Save felipecastrosales/e3f0c178f858cba22c344b4d86766996 to your computer and use it in GitHub Desktop.
Save felipecastrosales/e3f0c178f858cba22c344b4d86766996 to your computer and use it in GitHub Desktop.
Maps Funções
void main() {
Map<String, dynamic> mapa = {
'nome': 'Felipe',
'numero': 40028922,
};
print(mapa);
print(mapa.length);
print(mapa.keys);
print(mapa.values);
mapa.forEach((key, value) {
print('Key: $key | Value: $value');
});
mapa.entries.forEach((e) {
print('Key: ${e.key} | Value: ${e.value}');
});
mapa.update('nome', (value) => 'Paulo Victor');
print(mapa);
mapa.remove('numero');
print(mapa);
mapa.addAll({'sobrenome': 'Silva'});
print(mapa);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment