Skip to content

Commit 73776f6

Browse files
committed
Enable profiling by default
1 parent 3211662 commit 73776f6

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

packages/sqlite_async/lib/src/sqlite_options.dart

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,9 @@ class SqliteOptions {
3232

3333
/// Whether queries should be added to the `dart:developer` timeline.
3434
///
35-
/// This is disabled by default, but can be enabled to identify long-running
36-
/// queries.
35+
/// By default, this is enabled if the `dart.vm.product` compile-time variable
36+
/// is not set to `true`. For Flutter apps, this means that [profileQueries]
37+
/// is enabled by default in debug and profile mode.
3738
final bool profileQueries;
3839

3940
const factory SqliteOptions.defaults() = SqliteOptions;
@@ -44,8 +45,12 @@ class SqliteOptions {
4445
this.synchronous = SqliteSynchronous.normal,
4546
this.webSqliteOptions = const WebSqliteOptions.defaults(),
4647
this.lockTimeout = const Duration(seconds: 30),
47-
this.profileQueries = false,
48+
this.profileQueries = _profileQueriesByDefault,
4849
});
50+
51+
// https://api.flutter.dev/flutter/foundation/kReleaseMode-constant.html
52+
static const _profileQueriesByDefault =
53+
!bool.fromEnvironment('dart.vm.product');
4954
}
5055

5156
/// SQLite journal mode. Set on the primary connection.

0 commit comments

Comments
 (0)