paginatedItemBuilderWithEndLoader method
Widget
paginatedItemBuilderWithEndLoader(
- BuildContext context,
- int index, [
- Animation<
double> ? animation
Implementation
Widget paginatedItemBuilderWithEndLoader(
BuildContext context,
int index, [
Animation<double>? animation,
]) {
final itemLocation = index + 1;
final isAtEnd = itemLocation == _cachedItems.length;
final nextChunkIsLoading = nextAvailableChunk.status != ChunkStatus.last;
/// Builds the item from user code or shows an error widget
Widget buildGuardedItem() {
try {
return paginatedItemBuilder(
context,
index,
animation,
);
} catch (e) {
return widget.itemErrorWidgetBuilder?.call(e) ?? DefaultErrorCard(e);
}
}
return isAtEnd && nextChunkIsLoading && widget.shouldShowItemLoader
? widget.itemLoadingWidget!
: buildGuardedItem();
}