Flutter and Dart client

Add plexivo_client to your Flutter or Dart app and use Plexivo Postgres: queries, joins, Auth, Realtime over WebSockets and more.

plexivo_client is the Flutter and Dart client for Plexivo Postgres as a backend. It is pure Dart and null-safe, for Android, iOS, the web, macOS, Windows, Linux and servers, and needs Dart 3.4 or later. This page is for version 0.4.0.

The full reference, with every method and example, is on pub.dev.

Install#

bash
flutter pub add plexivo_client

Or add it to pubspec.yaml:

yaml
dependencies:
  plexivo_client: ^0.4.0

Quick start#

sql
create table todos (
  id bigint generated always as identity primary key,
  owner uuid not null default auth.uid(),
  title text not null,
  done boolean not null default false,
  created_at timestamptz not null default now()
);
alter table todos enable row level security;
create policy own_todos on todos for all to authenticated
  using (owner = auth.uid()) with check (owner = auth.uid());
dart
import 'package:plexivo_client/plexivo_client.dart';

final db = PlexivoClient(dataUrl, publishableKey);
await db.signUp(email: email, password: password);

await db.from('todos').create({'title': 'Ship it'});
final open = await db.from('todos').where('done', false).order('created_at', 'desc').limit(20);
print(open.first['title']);

Pass the database’s Project URL and Publishable key, both on its Connect tab. In a Flutter app, pass them with --dart-define rather than writing them in your source.

Results#

Awaiting a query gives a PlexivoResult: a List<Map<String, dynamic>> that also carries count. first(id) and single() throw RecordNotFoundException when no row matches; firstOrNull and maybeSingle give null.

dart
final page = await db.from('todos').select('id, title', 'exact').range(0, 9);
print('${page.length} of ${page.count}');

final maybe = await db.from('todos').firstOrNull(999999);   // null
final one = await db.from('todos').where('title', 'Ship it').maybeSingle();
print(one.data?['title']);

What it covers#

AreaMethodsGuide
Queriesfrom, select, where and every operator, order, limit, range, paginate, count, aggregate, groupBy; Supabase’s eq, inFilter, isFilter, or, singleQueries
Joinspreload, joins, whereHas, withCount, orderReferenced, model relationsJoins
Writescreate, createMany, upsert, save, update, increment, deleteWrites
Transactions and functionstransaction with insert(…).ref(), lockForUpdate, rpcTransactions
AuthsignUp, signInWithPassword, signInWithOtp, getOAuthSignInUrl, signInAnonymously, linkEmail, updateUser, authStateChanges, listSessions, mfa, orgsAuth
Realtimechannel, changes, on, presence, statusChanges, readyRealtime
GraphQLgraphql, graphqlSubscribeGraphQL
Functionsfunctions.invokeFunctions
Server onlyraw, exec, sql.transaction, migrate, migratorRaw SQL

A web build given the secret key throws secret_key_in_browser: the secret key belongs on servers only.

Keep sessions safe#

Store the session in encrypted device storage: save it from authStateChanges and pass it back as initialSession. The Flutter guide shows it with flutter_secure_storage.

Updated 28 October 2026