pocketbase_drift
0.7.2, released 14 days ago by an unverified publisher
Offline-first PocketBase client using Drift for local caching
What it does
It extends the PocketBase SDK to cache all collections in a local SQLite database and automatically sync changes when connectivity is restored. The API mirrors PocketBase’s, but all reads can be served from the local store and writes are queued for later sync.
AI-written summary of version 0.7.2, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need offline support for a PocketBase-backed app
- You want reactive UI updates from local data changes
- You want full-text search and complex local filtering without server round-trips
Skip it when
- You only need a simple client with no offline requirements
- Your app already uses another offline persistence layer
- You need cross-platform support beyond Flutter (e.g., pure Dart)
Strengths
- Automatic offline sync and conflict handling
- Reactive streams that update UI immediately
- Full-text search and powerful local filtering
- Cross-platform Flutter support
Weaknesses
- Adds Drift and SQLite dependencies, increasing bundle size
- Only works with PocketBase, not other backends
- Setup requires defining a Drift schema for each collection
Setup
- Kind
- Flutter widgets
- Effort
- Medium
- Code generation
- No
- Direct dependencies
- 9
Add pocketbase_drift to pubspec, initialize with $PocketBase.database, define a Drift schema for collections, run any necessary build steps for Drift (build_runner)
```dart
import 'package:pocketbase_drift/pocketbase_drift.dart';
final client = $PocketBase.database('http://127.0.0.1:8090');
// Watch a collection reactively
final stream = client.watchRecordsState('posts');
stream.listen((state) {
if (state.hasError) {
print('Error: ${state.error}');
} else {
print('Fetched ${state.data?.length} posts');
}
});
```Alternatives
Packages that do the same job and could replace pocketbase_drift.
- posthog_flutter
Flutter client for PostHog analytics, feature flags, and session replay
84Compare - firebase_database
Flutter plugin for Firebase Realtime Database with offline access and realtime syncing.
91Compare - cloud_firestore
Flutter plugin for Cloud Firestore noSQL database with live synchronization.
98Compare - postgrest
Dart client library offering an ORM‑like interface to PostgREST/Supabase databases.
88Compare
Works with
Packages commonly used together with pocketbase_drift: ones it builds on, ones built on it, and its own family.
- loggingpocketbase_drift depends on itProvides configurable logging with levels and stream listeners for Dart apps.
- path_providerpocketbase_drift depends on itProvides Flutter APIs to locate common filesystem directories on Android, iOS, macOS, Linux and Windows.
- shared_preferencespocketbase_drift depends on itFlutter plugin for reading and writing simple key-value pairs. Wraps NSUserDefaults on iOS and SharedPreferences on Android.
- connectivity_pluspocketbase_drift depends on itDiscover the state of network connectivity (WiFi, mobile, ethernet) on Android, iOS, Web and desktops.
- sqlite3pocketbase_drift depends on itLightweight and convenient SQLite bindings for Dart using dart:ffi
- driftpocketbase_drift depends on itDrift is a reactive library to store relational data in Dart and Flutter applications.
- pocketbasepocketbase_drift depends on itMulti-platform Dart SDK for PocketBase open-source backend