Skip to content

Commit 6d4969a

Browse files
Lints: use const
1 parent f6957ec commit 6d4969a

File tree

3 files changed

+31
-29
lines changed

3 files changed

+31
-29
lines changed

bin/objectbox.dart

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
// ignore_for_file: avoid_print
2+
13
import 'dart:io';
24

35
import 'package:args/args.dart';
@@ -7,9 +9,9 @@ import 'package:benchapp/time_tracker.dart';
79
void main(List<String> arguments) async {
810
exitCode = 0; // presume success
911

10-
final argDb = 'db';
11-
final argCount = 'count';
12-
final argRuns = 'runs';
12+
const argDb = 'db';
13+
const argCount = 'count';
14+
const argRuns = 'runs';
1315

1416
final parser = ArgParser()
1517
..addOption(argDb, defaultsTo: 'benchmark-db', help: 'database directory')

lib/main.dart

Lines changed: 25 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ import 'hive_executor.dart' as hive;
1111
import 'isar_sync_executor.dart' as isar_sync;
1212
import 'obx_executor.dart' as obx;
1313
import 'sqf_executor.dart' as sqf;
14+
1415
// import 'hive_lazy_executor.dart' as hive_lazy;
1516
import 'time_tracker.dart';
1617

@@ -183,7 +184,7 @@ class _MyHomePageState extends State<MyHomePage> {
183184

184185
Future<void> printResult(String value) async {
185186
setState(() => _result = value);
186-
await Future.delayed(Duration(seconds: 0)); // yield to re-render
187+
await Future.delayed(const Duration(seconds: 0)); // yield to re-render
187188
}
188189

189190
/// Waits for the given future to complete. Returns true if the benchmark
@@ -421,13 +422,13 @@ class _MyHomePageState extends State<MyHomePage> {
421422
mainAxisAlignment: MainAxisAlignment.center,
422423
children: [
423424
Row(children: [
424-
Spacer(),
425+
const Spacer(),
425426
DropdownButton(
426427
value: _db,
427428
items: enumDropDownItems(DbEngine.values),
428429
onChanged: (DbEngine? value) =>
429430
configure(value!, _mode, _indexed)),
430-
Spacer(),
431+
const Spacer(),
431432
DropdownButton(
432433
value: _mode,
433434
// TODO items: enumDropDownItems(Mode.values),
@@ -444,71 +445,70 @@ class _MyHomePageState extends State<MyHomePage> {
444445
(mode != Mode.Queries && mode != Mode.QueryById))
445446
.toList()),
446447
onChanged: (Mode? value) => configure(_db, value!, _indexed)),
447-
Spacer(),
448-
Text('Index'),
448+
const Spacer(),
449+
const Text('Index'),
449450
if (_db == DbEngine.Hive)
450-
Text(' not available')
451+
const Text(' not available')
451452
else
452453
Switch(
453454
value: _indexed,
454455
onChanged: (bool value) => configure(_db, _mode, value),
455456
activeTrackColor: Colors.yellow,
456457
activeColor: Colors.orangeAccent,
457458
),
458-
Spacer(),
459+
const Spacer(),
459460
]),
460461
Row(children: [
461-
Spacer(),
462+
const Spacer(),
462463
Expanded(
463464
child: TextField(
464465
keyboardType: TextInputType.number,
465466
controller: _runsController,
466-
decoration: InputDecoration(
467+
decoration: const InputDecoration(
467468
labelText: 'Runs',
468469
),
469470
)),
470-
if (_mode == Mode.Queries) Spacer(),
471+
if (_mode == Mode.Queries) const Spacer(),
471472
if (_mode == Mode.Queries)
472473
Expanded(
473474
child: TextField(
474475
keyboardType: TextInputType.number,
475476
controller: _operationsController,
476-
decoration: InputDecoration(
477+
decoration: const InputDecoration(
477478
labelText: 'Operations',
478479
),
479480
)),
480-
if (_mode == Mode.QueryById) Spacer(),
481+
if (_mode == Mode.QueryById) const Spacer(),
481482
if (_mode == Mode.QueryById)
482483
Expanded(
483484
child: TextField(
484485
keyboardType: TextInputType.number,
485486
controller: _resultsController,
486-
decoration: InputDecoration(
487+
decoration: const InputDecoration(
487488
labelText: 'Results',
488489
),
489490
)),
490-
Spacer(),
491+
const Spacer(),
491492
Expanded(
492493
child: TextField(
493494
keyboardType: TextInputType.number,
494495
controller: _objectsController,
495-
decoration: InputDecoration(
496+
decoration: const InputDecoration(
496497
labelText: 'Objects',
497498
),
498499
)),
499-
Spacer(),
500+
const Spacer(),
500501
]),
501-
Spacer(),
502+
const Spacer(),
502503
Text(_result),
503-
Spacer(),
504+
const Spacer(),
504505
Container(
505-
padding: EdgeInsets.symmetric(horizontal: 30),
506+
padding: const EdgeInsets.symmetric(horizontal: 30),
506507
child: Table(
507-
border: TableBorder(
508-
horizontalInside:
509-
BorderSide(color: const Color(0x55000000))),
508+
border: const TableBorder(
509+
horizontalInside: BorderSide(color: Color(0x55000000))),
510510
children: _resultRows)),
511-
Spacer(),
511+
const Spacer(),
512512
],
513513
)),
514514
),
@@ -518,12 +518,12 @@ class _MyHomePageState extends State<MyHomePage> {
518518
? FloatingActionButton(
519519
onPressed: _stopBenchmark,
520520
tooltip: 'Stop',
521-
child: Icon(Icons.stop),
521+
child: const Icon(Icons.stop),
522522
)
523523
: FloatingActionButton(
524524
onPressed: _runBenchmark,
525525
tooltip: 'Start',
526-
child: Icon(Icons.play_arrow),
526+
child: const Icon(Icons.play_arrow),
527527
), // This trailing comma makes auto-formatting nicer for build methods.
528528
);
529529
}

lib/sqf_executor.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ class ExecutorRel<T extends RelSourceEntity> extends ExecutorBaseRel<T> {
162162
static Future<ExecutorRel<T>> create<T extends RelSourceEntity>(
163163
TimeTracker tracker, Database db) async {
164164
final table = T.toString();
165-
final tableTarget = 'RelTargetEntity';
165+
const tableTarget = 'RelTargetEntity';
166166

167167
await db.execute('''
168168
CREATE TABLE $table (

0 commit comments

Comments
 (0)