I am ne to dart.
In python it was
[["A","B"],["C","D","E"],["F","G"]]
In dart It was Showing error Help me
CodePudding user response:
Just use spread operator '...'
[...["A","B"],...["C","D","E"],...["F","G"]]
Hope it helps
CodePudding user response:
void main() {
// example 1
print([...['A', 'B'], ...['C', 'D', 'E'], ...['F', 'G']]);
// output: [A, B, C, D, E, F, G]
// example 2
var characters1 = <String>['A', 'B'];
var characters2 = <String>['C', 'D', 'E'];
var characters3 = <String>['F', 'G'];
var allCharacters = [...characters1, ...characters2, ...characters3];
print(allCharacters);
// output: [A, B, C, D, E, F, G]
}
Read here for more about the
spread operator ...