From d1b265dc70a7a91a4999c226b021921cc2644a29 Mon Sep 17 00:00:00 2001 From: Akiba So Date: Tue, 23 Jun 2026 09:57:04 +0800 Subject: [PATCH] chore: clean analyzer to zero issues Whole-project `flutter analyze` exited 1 on 17 pre-existing info/warning lints (no errors) in dev tools and test files. Clean them so analyze is green: - editor_repository_test: drop the redundant sqflite_common import; keep the used utils import with a transitive-dep ignore. - pen_* widget tests: `(_, __)` wildcard params -> `(_, _)`. - search_snippet_test / gen_bench_pdf / gen_dense_strokes: drop needless interpolation braces; remove an unused `Size` show and an unused local; mark the gen tool as print-allowed. No runtime behavior changed. flutter analyze: No issues found. Affected tests: 22/22 pass. --- test/editor_repository_test.dart | 3 +-- test/pen_canvas_widget_test.dart | 2 +- test/pen_coordinate_widget_test.dart | 2 +- test/pen_tool_widget_test.dart | 2 +- test/pen_zoom_widget_test.dart | 2 +- test/search_snippet_test.dart | 2 +- tool/gen_bench_pdf.dart | 4 ++-- tool/gen_dense_strokes.dart | 12 ++---------- 8 files changed, 10 insertions(+), 19 deletions(-) diff --git a/test/editor_repository_test.dart b/test/editor_repository_test.dart index 3a96429..26f0b2b 100644 --- a/test/editor_repository_test.dart +++ b/test/editor_repository_test.dart @@ -9,8 +9,7 @@ import 'dart:io'; import 'package:flutter_test/flutter_test.dart'; import 'package:path/path.dart' as p; -import 'package:sqflite_common/sqlite_api.dart'; -import 'package:sqflite_common/utils/utils.dart' as sqflite_utils; +import 'package:sqflite_common/utils/utils.dart' as sqflite_utils; // ignore: depend_on_referenced_packages import 'package:sqflite_common_ffi/sqflite_ffi.dart'; import 'package:badnote/editor/engine/stroke_model.dart'; diff --git a/test/pen_canvas_widget_test.dart b/test/pen_canvas_widget_test.dart index b1908a1..83734f5 100644 --- a/test/pen_canvas_widget_test.dart +++ b/test/pen_canvas_widget_test.dart @@ -36,7 +36,7 @@ void main() { strokeWidth: 0.004, allowFingerDrawing: allowFinger, onStrokeComplete: onComplete, - onEraseStroke: (_, __) {}, + onEraseStroke: (_, _) {}, ), ), ), diff --git a/test/pen_coordinate_widget_test.dart b/test/pen_coordinate_widget_test.dart index ebeba46..8f7c8d6 100644 --- a/test/pen_coordinate_widget_test.dart +++ b/test/pen_coordinate_widget_test.dart @@ -34,7 +34,7 @@ void main() { color: const Color(0xFF000000), strokeWidth: 0.004, onStrokeComplete: committed.add, - onEraseStroke: (_, __) {}, + onEraseStroke: (_, _) {}, ), ), ), diff --git a/test/pen_tool_widget_test.dart b/test/pen_tool_widget_test.dart index b1bdafe..6861610 100644 --- a/test/pen_tool_widget_test.dart +++ b/test/pen_tool_widget_test.dart @@ -34,7 +34,7 @@ void main() { strokeWidth: 0.02, allowFingerDrawing: allowFinger, onStrokeComplete: onComplete, - onEraseStroke: (_, __) {}, + onEraseStroke: (_, _) {}, ), ), ), diff --git a/test/pen_zoom_widget_test.dart b/test/pen_zoom_widget_test.dart index dbf6da2..372076b 100644 --- a/test/pen_zoom_widget_test.dart +++ b/test/pen_zoom_widget_test.dart @@ -29,7 +29,7 @@ void main() { color: const Color(0xFF000000), strokeWidth: 0.004, onStrokeComplete: (_) {}, - onEraseStroke: (_, __) {}, + onEraseStroke: (_, _) {}, ), ), ), diff --git a/test/search_snippet_test.dart b/test/search_snippet_test.dart index 4c6b571..5667019 100644 --- a/test/search_snippet_test.dart +++ b/test/search_snippet_test.dart @@ -53,7 +53,7 @@ void main() { test('the full match is included even when longer than the window', () { final long = 'x' * 100; - final s = snippetFor('pre ${long} post', long, window: 10)!; + final s = snippetFor('pre $long post', long, window: 10)!; expect(s.match, long); expect(s.matchLength, 100); }); diff --git a/tool/gen_bench_pdf.dart b/tool/gen_bench_pdf.dart index 43affe6..3ba8b45 100644 --- a/tool/gen_bench_pdf.dart +++ b/tool/gen_bench_pdf.dart @@ -27,7 +27,7 @@ import 'dart:io'; import 'dart:math'; -import 'dart:ui' show Offset, Rect, Size; +import 'dart:ui' show Offset, Rect; import 'package:flutter_test/flutter_test.dart'; import 'package:syncfusion_flutter_pdf/pdf.dart'; @@ -207,7 +207,7 @@ void main() { final sizeKb = (outFile.lengthSync() / 1024).toStringAsFixed(1); print('Generated: $outputPath'); print('Pages: $pageCount'); - print('Size: ${sizeKb} KB (${outFile.lengthSync()} bytes)'); + print('Size: $sizeKb KB (${outFile.lengthSync()} bytes)'); expect(outFile.existsSync(), isTrue); expect(outFile.lengthSync(), greaterThan(1024), diff --git a/tool/gen_dense_strokes.dart b/tool/gen_dense_strokes.dart index dde7d3d..aed2b36 100644 --- a/tool/gen_dense_strokes.dart +++ b/tool/gen_dense_strokes.dart @@ -1,3 +1,4 @@ +// ignore_for_file: avoid_print // tool/gen_dense_strokes.dart // // Generates synthetic ink-stroke datasets as JSON matching InkStroke.toJson() @@ -52,7 +53,7 @@ void main(List args) { final sizeKb = (File(outputPath).lengthSync() / 1024).toStringAsFixed(1); print('Output: $outputPath'); - print('Size: ${sizeKb} KB'); + print('Size: $sizeKb KB'); for (final count in counts) { print(' "$count": ${(result[count.toString()] as List).length} strokes'); } @@ -183,15 +184,6 @@ void _verifyRoundTrip(dynamic dataset) { final encoded = jsonEncode(raw); final decoded = jsonDecode(encoded) as Map; - // Assert required InkStroke fields exist with correct types. - void check(String field, Type type) { - final val = decoded[field]; - assert( - val == null || val.runtimeType.toString().contains(type.toString()) || val is num || val is String || val is bool || val is List, - 'Field "$field" missing or wrong type: ${val.runtimeType}', - ); - } - assert(decoded['id'] is String, 'id must be String'); assert(decoded['points'] is List, 'points must be List'); assert(decoded['tool'] == 'pen', 'tool enum must be "pen"');