# Flutter InstantDB — Full Documentation
> Flutter SDK for InstantDB — a real-time, offline-first, local-first database with reactive bindings. Type-safe InstaQL queries, optimistic InstaML transactions, WebSocket sync, auth, presence/rooms, file storage, and reactive widgets for iOS, Android, Web, macOS, Windows, and Linux.
---
# Flutter InstantDB
> Real-time, offline-first database for Flutter with reactive bindings, type-safe queries and code generation.
Source: https://flutter-instantdb.vercel.app/docs
A Flutter/Dart port of [InstantDB](https://instantdb.com) — a real-time,
offline-first database with reactive bindings, a type-safe query DSL, code
generation, and live multiplayer collaboration.
Add the package and initialize the client.
Reactive queries, transactions, and your first live widget.
Compile-time-safe queries and writes generated from your models.
Annotate a model, run the generator, get typed tables.
## A taste
```dart
final db = await InstantDB.init(
appId: 'your-app-id',
config: const InstantConfig(syncEnabled: true),
);
final todos = await TodoTable()
.query()
.where((t) => t.done.eq(false))
.order((t) => t.createdAt.desc())
.getAll(db);
await db.transact(
TodoTable().tx(db).createModel(
Todo(id: db.id(), title: 'Ship it', done: false),
),
);
```
---
# Migration Strategies
> Upgrading Flutter InstantDB and handling data migrations
Source: https://flutter-instantdb.vercel.app/docs/advanced/migration
Handle Flutter InstantDB package updates, data migrations, and schema changes with confidence using proven migration strategies and tools.
## Package Updates
### Semantic Versioning
Flutter InstantDB follows semantic versioning (semver):
- **Patch releases** (0.1.1 → 0.1.2): Bug fixes, no breaking changes
- **Minor releases** (0.1.0 → 0.2.0): New features, backward compatible
- **Major releases** (0.1.0 → 1.0.0): Breaking changes, requires migration
### Safe Update Process
Follow this process for safe updates:
```dart
// 1. Check current version
void checkCurrentVersion() {
// Add to pubspec.yaml temporarily to see current version
print('Current InstantDB version: check pubspec.yaml');
}
// 2. Read changelog before updating
// Always check CHANGELOG.md on GitHub or pub.dev
// 3. Update in development first
// Test thoroughly in development before production
// 4. Create backup of critical data if needed
Future backupCriticalData(InstantDB db) async {
final criticalEntities = ['users', 'payments', 'orders'];
final backup = >>{};
for (final entityType in criticalEntities) {
final result = await db.queryOnce({entityType: {}});
backup[entityType] = (result.data?[entityType] as List? ?? [])
.cast