indexつきList.map()
asMap()によってリスト要素をindex keyを使ったMapを作成する。そのentriesをmap()することでkeyがindex, valueがリスト要素のMapEntryをcallback関数のエレメントでうけとることができる。
code: dart
.asMap()
.entries
.map((entry) => Tab(
icon: Text(
entry.value,
style: TextStyle(
color:
today.weekday == entry.key + 1 ? Colors.red : Colors.white),
)))
.toList()