Last active
January 15, 2020 11:30
-
-
Save Blasanka/791f022c90b7a38822fa77acf0781682 to your computer and use it in GitHub Desktop.
How to add values to a Map and finally that map to a list (Dart).
This file contains 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() { | |
List<Map> _pecasList = []; | |
List<String> alphas = ["a", "b", "c"]; | |
Map<String, dynamic> newPecas = Map(); | |
for (String c in alphas) { | |
if (c.isEmpty || c.trimLeft() == "") { | |
print("Campo Vazio"); | |
} else { | |
newPecas["title$c"] = c.trimLeft(); | |
} | |
} | |
_pecasList.add(newPecas); | |
print(_pecasList); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment