whenData method

  1. @override
Widget whenData(
  1. BuildContext context,
  2. List<T> items
)
override

This is the callback used to build the list/grid when data is available

Implementation

@override
Widget whenData(BuildContext context, List<T> items) {
  if (items.isEmpty && emptyBuilder != null) {
    return emptyBuilder?.call(context) ?? const SliverToBoxAdapter();
  }
  return SliverList(
    delegate: SliverChildBuilderDelegate(
      (context, index) => itemBuilder(items[index]),
      childCount: items.length,
    ),
  );
}