Flutter guide
Generate Dart models from your schema and build an offline-first mobile app.
Sp00ky provides Dart code generation for Flutter integration, allowing for natively typed data models.
Note
The Flutter/Dart client is currently in development. This guide shows the generated Dart models and how to use them with SurrealDB’s Dart client.
Generate Dart Models
Use the Sp00ky CLI to generate Dart models from your SurrealDB schema:
This generates Dart classes with JSON serialization for your schema tables.
Generated Models Example
The CLI generates strongly-typed Dart classes for each table in your schema:
lib/models.dart
Usage with SurrealDB Dart Client
Use the generated models with the official SurrealDB Dart client:
lib/database.dart
Flutter UI Example
Here’s how to use the database in a Flutter widget:
lib/screens/threads_screen.dart
Next steps
Generated types Configure the Dart output and keep models in sync with the schema. Offline & sync health Surface connection state and pending writes in your UI. SurrealDB Dart SDK Upstream client documentation for everything below Sp00ky. How it works Why these queries stay current without polling.
Pair this with a state-management solution such as Riverpod for reactive data binding.