Define generic type T for the list item.
typedef ItemBuilder<T> = Widget Function(T item, int index);