패키지, 저장소 및 앱 카테고리 검색

패키지 상세v4.3.0

firebase_pagination

실시간 데이터베이스와 Firestore를 페이지네이션하고 실시간 업데이트를 지원하는 플러터 패키지입니다.

AndroidiOSWebmacOSWindows
30일 다운로드
2.9천
좋아요
92
Pub 점수
160

패키지 설치

flutter pub add firebase_pagination

패키지 개요

공개 정보를 바탕으로 생성한 선택 가이드입니다.

Firebase Pagination은 Firebase 실시간 데이터베이스 및 Firestore에서 데이터를 효율적으로 페이지네이션하기 위해 설계된 Flutter 패키지로, 실시간 업데이트를 지원합니다. 대규모 데이터셋을 단계적으로 로드하는 과정을 간소화하여 부드러운 성능과 실시간 동기화를 보장합니다. 이 패키지는 Flutter의 ListView 및 기타 스크롤 가능한 위젯과 원활하게 통합되어 로딩 상태 및 리스트 끝 감지와 같은 페이지네이션 로직을 자동으로 처리합니다. 채팅 인터페이스, 소셜 미디어 피드 또는 콘텐츠 목록과 같이 동적이고 반응형 데이터 흐름이 필요한 앱에 적합합니다.

사용 사례

  • 실시간 채팅 애플리케이션
  • 소셜 미디어 피드 구현
  • 콘텐츠가 풍부한 대시보드
  • 실시간 업데이트와 함께 동적 목록 로딩
  • 오프라인 사용 가능한 데이터 가져오기

주요 기능

  • Firebase에서의 실시간 업데이트
  • 자동 페이지네이션 처리
  • 실시간 데이터베이스 및 Firestore 지원
  • 내장된 로딩 및 오류 상태
  • ListView 및 ScrollViews와의 원활한 통합

적합한 대상

  • Firebase를 사용하여 실시간 앱을 개발하는 개발자
  • 효율적인 데이터 로딩이 필요한 앱
  • 오프라인 지원과 동기화가 필요한 프로젝트
  • Flutter와 Firebase 백엔드를 사용하는 팀

고려 사항

  • Firebase 설정 및 구성이 필요합니다
  • 대규모 데이터 세트에 맞춤 캐싱 전략이 필요할 수 있습니다
  • Firebase 소스만 제한
  • 성능은 네트워크 상태와 데이터 크기에 따라 달라집니다

원본 README

연결된 소스 저장소의 README 원문 스냅샷입니다. 최신 내용은 저장소에서 확인하세요.

Firebase Pagination

A simple and effective way to Paginate Firebase related data.

pub package GitHub

GitHub issues open GitHub issues closed


Realtime Database Firestore
RealtimeDB Ascending Pagination Demo Firestore Pagination Demo
RealtimeDB Descending Pagination Demo

Features

  • FirestorePagination to simplify paginating firestore collections.
  • RealtimeDBPagination to simplify paginating realtime database nodes.
  • Get live updates when new data is added using isLive property.
  • Get realtime changes on already loaded data.
  • Descending pagination for RealtimeDBPagination.

Getting started

Add to Dependencies
firebase_pagination: ^4.2.0
Import the package
import 'package:firebase_pagination/firebase_pagination.dart';

Usage

Simplest Firestore Pagination
FirestorePagination(
  query: FirebaseFirestore.instance.collection('scores').orderBy('score'),
  itemBuilder: (context, docs, index) {
    final data = docs[index].data() as Map<String, dynamic>;

    // Do something cool with the data
  },
),
Simplest Firebase Realtime Database Pagination
RealtimeDBPagination(
  query: FirebaseDatabase.instance.ref().child('scores').orderByChild('score'),
  orderBy: 'score',
  itemBuilder: (context, dataNodes, index) {
    final data = dataNodes[index].value as Map<String, dynamic>;

    // Do something cool with the data
  },
),
For more examples, see the examples section.

How it Works

  • A data listener is added to the query with the given limit.
  • Every time the user scrolls to the bottom of the list, the limit is increased.
  • If there are any changes for the loaded data, it will be automatically updated.
  • If isLive is true, a live listener is added to fetch data before the first load. (i.e. Newly added data will be automatically loaded)
  • When new data is added, the data listener will be removed and a new data listener will be added with the new limit.
  • Also the live listener will be removed and a new live listener will be added.

Efficiency & Performance

  • Both FirestorePagination and RealtimeDBPagination uses maximum of two stream listeners to fetch data.
  • Hence it is performant and uses minimum amount of resources.
  • The listeners are automatically removed when the widget is removed from the widget tree.
  • For fetching data, the widgets uses this hack to minimize the number of reads from the database.

Description

Property Description Type Default
query The query to use to fetch data from Firestore / Realtime Database. Query -
itemBuilder The builder to use to build the items in the list. Function -
separatorBuilder The builder to use to render the separator. Function separatorBuilder (package fn)
limit The number of items to fetch from Database at once. int 10
viewType The type of view to use for the list. ViewType ViewType.list
isLive Whether to fetch newly added items as they are added to Database. bool false
gridDelegate The delegate to use for the GridView. SliverGridDelegate crossAxisCount: 2
wrapOptions The Wrap widget properties to use. WrapOptions WrapOptions()
pageOptions The PageView widget properties to use. PageOptions PageOptions()
onEmpty The widget to use when data is empty. Widget EmptyScreen()
bottomLoader The widget to use when more data is loading. Widget BottomLoader()
initialLoader The widget to use when data is loading initially. Widget InitialLoader()
scrollDirection The scrolling direction of the ScrollView. Axis false
reverse Whether the ScrollView scrolls in the reading direction. bool false
shrinkWrap Should the ScrollView be shrink-wrapped. bool false
physics The scroll behavior to use for the ScrollView. ScrollPhysics -
padding The padding to use for the ScrollView. EdgeInsetsGeometry -
controller The controller to use for the ScrollView. ScrollController ScrollController()
pageController The controller to use for the PageView. PageController PageController()
descending Whether the data should be fetched in descending order or not. Only works for RealtimeDBPagination bool false
If you liked the package, then please give it a Like 👍🏼 and Star ⭐

카테고리

의존성

의존성 목록 2 개

소스 저장소

이 패키지를 사용하는 프로젝트

아직 데이터가 없습니다.