Introduction
Sometimes, we may wish to flatMap a list of lists in Flutter/Dart. In this post, we'll learn how to do it.
How to flatMap a list of lists in Flutter
To flatten a list of lists in Flutter/Dart we can use forEach()
or expand()
method:
Flatten a list of lists in Flutter using forEach()
method
The output:
Flatten a list of lists using expand()
method
The output:
Conclusion
In this article, we showed how to flatMap
a list of lists in Flutter/Dart.
{{ 'Comments (%count%)' | trans {count:count} }}
{{ 'Comments are closed.' | trans }}