widgetMap<T> function

List<Widget> widgetMap<T>(
  1. List<T> widgets,
  2. List<Widget> mapFunc(
    1. T
    )
)

Maps each item in widgets through mapFunc and flattens the result.

Implementation

List<Widget> widgetMap<T>(List<T> widgets, List<Widget> Function(T) mapFunc) {
  return [...widgets.map(mapFunc).expand((element) => element)];
}