I have a list of String
s, e.g.,
var moviesTitles = ['Inception', 'Heat', 'Spider Man'];
and wanted to use moviesTitles.map
to convert them to a list of Tab
Widget
s in Flutter.
you can use
moviesTitles.map((title) => Tab(text: title)).toList()
example:
bottom: new TabBar(
controller: _controller,
isScrollable: true,
tabs:
moviesTitles.map((title) => Tab(text: title)).toList()
,
),