read<T> abstract method
Create a synchronous read transaction.
Explicit read transactions are optional, but they allow you to do atomic reads and rely on a consistent state of the database inside the transaction. Internally DatabaseUniverse always uses implicit read transactions for all read operations.
It is recommended to use an explicit read transactions when you want to perform multiple subsequent read operations.
Example:
final (user, workspace) = database_universe.read((database_universe) {
final user = database_universe.users.where().findFirst();
final workspace = database_universe.workspaces.where().findFirst();
return (user, workspace);
});
Implementation
T read<T>(T Function(DatabaseUniverse databaseUniverse) callback);