
PocketBase Dart SDK
https://github.com/pocketbase/dart-sdk- Category
- Developer Tools
- Rank
- No. 743Tools index
- Pricing
- Open Source
- Type
- TOOL
- Builder
- pocketbase
- GitHub
- 716 stars
- Date
About
Official Dart/Flutter SDK for PocketBase. Auth, realtime, and CRUD against a PocketBase backend from any Dart app.
What it does
This client turns PocketBase’s HTTP and realtime interfaces into Dart objects, futures, streams, and service groups. It manages authentication state, serializes JSON or multipart requests, casts record values, and converts failed responses into one consistent error shape.
Why it's ranked here
A strong default for Dart teams already committed to PocketBase. It covers records, files, collections, backups, cron jobs, logs, settings, health checks, SQL debugging, and transactional batches. Its documented lifecycle and OAuth caveats keep the convenience honest.
What's good
Filter placeholders escape strings and encode dates or structured values. Errors retain the request address, status, response data, abort state, and original failure. Record helpers read nested expanded data with typed conversions. Authentication changes arrive through a broadcast stream, while an adapter supports external persistence.
Tradeoffs
Authentication lives only in memory by default. Requests normally create and close an HTTP client each time; connection reuse requires explicit shutdown. Value casting applies forgiving defaults that can hide malformed data. The all-in-one OAuth flow needs extra handling on newer Android systems and can fail with dual-stack server networking.
How to use it well
Use it for Dart or Flutter clients whose backend is already PocketBase. Define typed application DTOs around returned records, connect authentication to your chosen persistent store, and decide explicitly whether connection reuse suits the client lifecycle. Prefer manual OAuth code exchange where background realtime connections are unreliable. It does not provide the backend itself.
Technical notes+
pubspec.yaml requires Dart 3 and declares http plus json_annotation as runtime dependencies. lib/pocketbase.dart exports the client, stores, DTOs, and service classes. lib/src/client.dart builds JSON or multipart requests, injects valid auth tokens and language headers, normalizes failures as ClientException, caches RecordService instances, and optionally retains one shared HTTP client. lib/src/caster.dart implements dot-path extraction and coercion for scalar, list, and RecordModel values. analysis_options.yaml enables strict casts, raw types, and inference. test/client_test.dart, test/caster_test.dart, test/auth_store_test.dart, test/async_auth_store_test.dart, and test/sync_queue_test.dart exercise request construction, casting, authentication state, persistence queuing, and operation ordering.
Observed
- License
- MIT License
- Primary language
- Dart
- Package surface
- Published as the pocketbase package and installable through Dart Pub or Flutter Pub
- Interface
- Future-based Dart library for the PocketBase Web API, with stream-based realtime events
- Runtime dependencies
- http and json_annotation
- Platform support
- Multi-platform Dart SDK with web-specific request behavior and documented Android OAuth guidance
- Repository structure
- Includes an example program, strict analyzer configuration, and multiple test files
Read from README.md, pubspec.yaml, LICENSE, CHANGELOG.md, analysis_options.yaml, lib/pocketbase.dart, example/example.dart, test/caster_test.dart, test/client_test.dart, test/auth_store_test.dart, test/sync_queue_test.dart, test/async_auth_store_test.dart, lib/src/caster.dart, lib/src/client.dart, lib/src/auth_store.dart.
What it can do
Authenticate users
User credentials (email/password or OAuth tokens) → Authentication tokens and user session
Create records in PocketBase collections
Record data and collection name → Created record with generated ID
Read records from PocketBase collections
Collection name and optional filters/queries → Retrieved record data
Update existing records in PocketBase collections
Record ID, updated data, and collection name → Updated record data
Delete records from PocketBase collections
Record ID and collection name → Deletion confirmation
Subscribe to realtime updates
Collection name and subscription parameters → Live data changes stream
Upload files to PocketBase
File data and record information → File URL and metadata
Tags
Tech Stack
Media
Comments (0)
No comments yet
Editorially curated, with community endorsements as a secondary signal. Corrections welcome.