← Flutter Reference

What is PowerSync in Flutter?

Data & Connectivity · Advanced

By Abdelrahman Saed — Senior Mobile Engineer. Last updated: 2026-08-10.

PowerSync is a sync engine that synchronizes a local SQLite database (via Drift or sqflite) with a Postgres backend in real time. It enables local-first Flutter apps where the UI reads and writes against the local database while PowerSync handles background synchronization, conflict resolution, and schema migrations.

How it works

PowerSync sits between the Postgres backend and the local SQLite database on the device:

Postgres → PowerSync Service → Sync Engine → Local SQLite (Drift) → UI

The key concepts:

1. Sync rules — server-side JSON config that defines which rows sync to which clients (selective per-user replication). 2. Views — PowerSync exposes its tables as views, so schema changes ship as versioned migrations that drop and recreate views rather than altering tables. 3. Conflict resolution — last-write-wins by default, with custom resolution hooks for complex cases. 4. Local writes — writes go to the local database first, then PowerSync queues and uploads them to Postgres.

At iStoria (5M+ users), PowerSync + Drift is the foundation of our offline-first architecture:

// PowerSync schema — mirrors the Postgres tables as local views
class Schema extends SchemaObject {
  @override
  List<Table> get tables => [
    Table('stories', [
      Column.text('id'),
      Column.text('title'),
      Column.integer('position'),
      Column.boolean('is_completed'),
    ]),
  ];
}

The UI reads from these tables via Drift's reactive streams — when PowerSync updates a row in the background, Drift emits a new stream event and the UI rebuilds automatically.

When to use it

Use PowerSync when:

  • You have a Postgres backend and want offline-first sync with conflict resolution.
  • You need selective per-user sync (not every user sees every row).
  • You want real-time updates without building a custom WebSocket/sync layer.

Don't use PowerSync when:

  • Your backend is not Postgres.
  • You need full-text search or complex server-side queries (PowerSync syncs data, not queries).
  • Your data set per user is too large for a local SQLite database.

Strengths

  • Automatic sync between Postgres and local SQLite — no custom sync layer
  • Selective per-user sync via sync rules — only relevant data hits the device
  • Conflict resolution built-in — last-write-wins by default, custom hooks available
  • Reactive — Drift streams pick up PowerSync changes automatically
  • Scales to millions of users (iStoria: 5M+ learners)

Tradeoffs

  • Postgres-only backend required
  • Self-hosting the PowerSync Service adds infrastructure
  • Schema migrations are view-based — different from standard Drift migrations
  • Local database size grows with synced data — needs pruning strategy

Comparisons

Related articles

Related case studies

FAQ

Is PowerSync free?

PowerSync offers a free tier (up to 5,000 monthly active users) and paid plans for larger scale. It is open-source and self-hostable via the PowerSync Service, which runs alongside your Postgres database.

How does PowerSync handle conflicts?

By default, PowerSync uses last-write-wins based on a timestamp column. For complex cases, you can define custom conflict resolution hooks on the server side that run during the sync process. At iStoria, the default works for 95% of our data; the other 5% uses server-side hooks.


Available for hire. Abdelrahman Saed is a Senior Mobile Engineer (Flutter) — open to full-time, fractional, contract, or advisory work. Hire me →

Book a 20-minute call · Download the CV (PDF) · See how I work