パッケージ、リポジトリ、アプリカテゴリを検索

パッケージ詳細v4.3.0

firebase_pagination

リアルタイムデータベースおよびFirestoreのページネーションとライブアップデートをサポートするFlutterパッケージ。

AndroidiOSWebmacOSWindows
30日間ダウンロード
2930
いいね数
92
Pub ポイント
160

パッケージをインストール

flutter pub add firebase_pagination

パッケージ概要

公開情報に基づく選定ガイドです。参考としてご利用ください。

Firebase Pagination は、Firebase Realtime Database および 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 件

ソースリポジトリ

このパッケージを使用しているプロジェクト

データはまだありません。