RealtimeDBPagination constructor

const RealtimeDBPagination({
  1. required Query query,
  2. required Widget itemBuilder(
    1. BuildContext,
    2. DataSnapshot,
    3. int
    ),
  3. required String? orderBy,
  4. Key? key,
  5. bool descending = false,
  6. Widget separatorBuilder(
    1. BuildContext,
    2. int
    )?,
  7. int limit = 10,
  8. ViewType viewType = ViewType.list,
  9. bool isLive = false,
  10. SliverGridDelegate gridDelegate = const SliverGridDelegateWithFixedCrossAxisCount(crossAxisCount: 2),
  11. WrapOptions wrapOptions = const WrapOptions(),
  12. Widget onEmpty = const EmptyScreen(),
  13. Widget bottomLoader = const BottomLoader(),
  14. Widget initialLoader = const InitialLoader(),
  15. Axis scrollDirection = Axis.vertical,
  16. bool reverse = false,
  17. bool shrinkWrap = false,
  18. ScrollPhysics? physics,
  19. EdgeInsetsGeometry? padding,
  20. ScrollController? controller,
})

Creates a StreamBuilder widget that automatically loads more data when the user scrolls to the bottom.

Optimized for FirebaseDatabase with fields like createdAt and timestamp to sort the data.

Supports live updates and realtime updates to loaded data.

Data can be represented in a ListView, GridView or scollable Wrap.

Implementation

const RealtimeDBPagination({
  required this.query,
  required this.itemBuilder,
  required this.orderBy,
  super.key,
  this.descending = false,
  this.separatorBuilder,
  this.limit = 10,
  this.viewType = ViewType.list,
  this.isLive = false,
  this.gridDelegate = const SliverGridDelegateWithFixedCrossAxisCount(
    crossAxisCount: 2,
  ),
  this.wrapOptions = const WrapOptions(),
  this.onEmpty = const EmptyScreen(),
  this.bottomLoader = const BottomLoader(),
  this.initialLoader = const InitialLoader(),
  this.scrollDirection = Axis.vertical,
  this.reverse = false,
  this.shrinkWrap = false,
  this.physics,
  this.padding,
  this.controller,
});