Mention where computeWithDatabase is most useful

This commit is contained in:
Simon Binder 2023-05-12 15:15:37 +02:00
parent 20b75bd7e3
commit a0b35ec6e0
No known key found for this signature in database
GPG Key ID: 7891917E4147B8C0
1 changed files with 6 additions and 0 deletions

View File

@ -307,6 +307,12 @@ extension ComputeWithDriftIsolate<DB extends DatabaseConnectionUser> on DB {
/// );
/// }
/// ```
///
/// Note that with the recommended setup of `NativeDatabase.createInBackground`,
/// drift will already use an isolate to run your SQL statements. Using
/// [computeWithDatabase] is beneficial when an an expensive work unit needs
/// to use the database, or when creating the SQL statements itself is
/// expensive.
@experimental
Future<Ret> computeWithDatabase<Ret>({
required FutureOr<Ret> Function(DB) computation,