Skip to content
pubscout

pocketbase_drift

0.7.2, released 14 days ago by an unverified publisher

Offline-first PocketBase client using Drift for local caching

WASM-readyUnverified publisher
$ flutter pub add pocketbase_drift
Source repository

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.

Works with

Packages commonly used together with pocketbase_drift: ones it builds on, ones built on it, and its own family.