AppEvent.query constructor
A database statement, with the SQL as the body so it can be read whole.
Report the app's own statements, not the schema's. Opening a database
costs a dozen before the app has done anything — BEGIN IMMEDIATE, the
migration bookkeeping, the create tables, COMMIT — and measured on a
real suite that was 1680 of 1874 events, 89% of the channel, drowning the
194 that were the app. It takes measuring to notice, because a busy pane
looks like a working one. Keep the decorator quiet until the database has
finished opening.
Implementation
AppEvent.query({
required String sql,
List<Object?> args = const [],
int? rows,
}) : channel = AppChannel.db,
title = foldSql(sql),
detail = rows == null ? null : '$rows ${rows == 1 ? 'row' : 'rows'}',
data = args.isEmpty ? const {} : {'args': args},
body = sql,
error = false,
level = null,
origin = null;