Dart
How generated Dart code is shaped and how to open runtime adapters correctly.
Dart
After generate, the normal path is to work through the generated client rather than through handwritten records and raw SQL strings.
Typical runtime shape
import 'generated/comon_orm_client.dart';
Future<void> main() async {
final db = await GeneratedComonOrmClientSqlite.open();
try {
final user = await db.user.create(
data: const UserCreateInput(
email: 'alice@example.com',
name: 'Alice',
),
);
final users = await db.user.findMany();
print(user.email);
print(users.length);
} finally {
await db.close();
}
}What the generated surface includes
- typed models and scalar enums
WhereInputandWhereUniqueInputtypes- CRUD delegates such as
findMany,create,update,delete, andupsert - relation-aware nested create and update inputs
select,include,orderBy,distinct,skip,take, aggregate, and group-by support
CRUD
See create, read, update, delete, batch writes, upsert, and count with concrete examples.
Filtering and sorting
See WhereInput, orderBy, distinct, skip/take, and cursor pagination.
Relations and includes
See nested writes, include trees, connect, disconnect, and connectOrCreate.
Aggregations
See aggregate(), groupBy(), and count() examples.
Transactions
See transaction blocks, rollback behavior, and multi-step write patterns.
Testing
Use openInMemory(), generated runtime metadata, and test-friendly adapters for fast feedback.
Generated client
See the delegate API and the main generated query capabilities.
Runtime and adapters
Choose the correct opener path for PostgreSQL, SQLite, in-memory, and Flutter SQLite.