chore: adopt Dart 3.9 toolchain — honest floor + tall-style reformat (T-353)

Raise the declared minimums in pubspec.yaml to what our deps already
require: Flutter >=3.35.0 / Dart >=3.9.0 (was 3.19.0 / 3.5.0). alchemist
0.12 needs Flutter 3.32; Dart 3.9 first ships in Flutter 3.35, so 3.35 is
the binding floor. Pin the exact build toolchain in .fvmrc (Flutter
3.44.1).

Moving to the Dart 3.9 language level switches `dart format` to the new
"tall" style and enables two new lints. This commit is the resulting
mechanical churn, isolated from any behaviour change:
  - whole-tree `dart format` reformat (tall style)
  - `dart fix` for unnecessary_underscores + use_null_aware_elements

No runtime behaviour change; `make test` green.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-06-11 12:11:53 +02:00
co-authored by Claude Opus 4.8
parent bcea5f15b7
commit 6d0ebab721
444 changed files with 7587 additions and 12849 deletions
+151 -122
View File
@@ -15,12 +15,12 @@ IpcResponse _ok(Map<String, Object?> data) => IpcResponse.ok(id: '', data: data)
Map<String, Object?> _buf(String id, String path, {bool dirty = false}) => {'id': id, 'path': path, 'dirty': dirty};
Map<String, Object?> _read(String id, String path, String content, {bool dirty = false}) => {
'id': id,
'path': path,
'content': content,
'selection': {'start': 0, 'end': 0},
'dirty': dirty,
};
'id': id,
'path': path,
'content': content,
'selection': {'start': 0, 'end': 0},
'dirty': dirty,
};
void emitEditor(DaemonBus bus, String kind, Map<String, Object?> data) {
bus.emit(DaemonEvent(subsystem: 'editor', kind: kind, data: data, ts: DateTime.now().toUtc()));
@@ -45,15 +45,17 @@ void main() {
group('hydrate', () {
test('populates the open-buffer list and loads the active buffer', () async {
ipc.stub(
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'lib/a.dart'), _buf('b_2', 'lib/b.dart', dirty: true)]
}));
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'lib/a.dart'), _buf('b_2', 'lib/b.dart', dirty: true)],
}),
);
ipc.stub(
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'}
}));
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'},
}),
);
ipc.stub('editor.read', (a) async => _ok(_read('b_1', 'lib/a.dart', 'hello')));
await c.hydrate();
@@ -66,10 +68,11 @@ void main() {
test('with no active buffer leaves the list but no active content', () async {
ipc.stub(
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'lib/a.dart')]
}));
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'lib/a.dart')],
}),
);
ipc.stub('editor.active', (_) async => _ok(const {})); // no `active` key
await c.hydrate();
@@ -93,15 +96,17 @@ void main() {
test('activate is a no-op when the id is already active', () async {
ipc.stub(
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'a.dart')]
}));
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'a.dart')],
}),
);
ipc.stub(
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'}
}));
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'},
}),
);
ipc.stub('editor.read', (_) async => _ok(_read('b_1', 'a.dart', 'x')));
await c.hydrate();
@@ -129,15 +134,17 @@ void main() {
test('editor.opened refreshes the list and loads the new active buffer', () async {
var listVersion = 1;
ipc.stub(
'editor.list',
(_) async => _ok({
'buffers': listVersion == 1 ? [_buf('b_1', 'a.dart')] : [_buf('b_1', 'a.dart'), _buf('b_2', 'b.dart')]
}));
'editor.list',
(_) async => _ok({
'buffers': listVersion == 1 ? [_buf('b_1', 'a.dart')] : [_buf('b_1', 'a.dart'), _buf('b_2', 'b.dart')],
}),
);
ipc.stub(
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'}
}));
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'},
}),
);
ipc.stub('editor.read', (a) async {
final id = a['id'] as String;
return _ok(_read(id, id == 'b_1' ? 'a.dart' : 'b.dart', 'content-$id'));
@@ -157,15 +164,17 @@ void main() {
test('editor.closed refreshes the list and clears active when it was active', () async {
var listVersion = 1;
ipc.stub(
'editor.list',
(_) async => _ok({
'buffers': listVersion == 1 ? [_buf('b_1', 'a.dart'), _buf('b_2', 'b.dart')] : [_buf('b_2', 'b.dart')]
}));
'editor.list',
(_) async => _ok({
'buffers': listVersion == 1 ? [_buf('b_1', 'a.dart'), _buf('b_2', 'b.dart')] : [_buf('b_2', 'b.dart')],
}),
);
ipc.stub(
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'}
}));
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'},
}),
);
ipc.stub('editor.read', (a) async => _ok(_read(a['id'] as String, 'a.dart', 'x')));
await c.hydrate();
expect(c.buffers, hasLength(2));
@@ -180,15 +189,17 @@ void main() {
test('editor.saved clears the dirty marker on the buffer', () async {
ipc.stub(
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'a.dart', dirty: true)]
}));
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'a.dart', dirty: true)],
}),
);
ipc.stub(
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'}
}));
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'},
}),
);
ipc.stub('editor.read', (_) async => _ok(_read('b_1', 'a.dart', 'x', dirty: true)));
await c.hydrate();
expect(c.buffers.single.dirty, isTrue);
@@ -202,15 +213,17 @@ void main() {
test('editor.edited marks the right buffer dirty, leaving siblings alone', () async {
ipc.stub(
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'a.dart'), _buf('b_2', 'b.dart')]
}));
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'a.dart'), _buf('b_2', 'b.dart')],
}),
);
ipc.stub(
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'}
}));
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'},
}),
);
ipc.stub('editor.read', (a) async => _ok(_read(a['id'] as String, 'a.dart', 'x')));
await c.hydrate();
expect(c.buffers.every((b) => !b.dirty), isTrue);
@@ -226,15 +239,17 @@ void main() {
test('editor.active-changed to a different buffer loads its content', () async {
ipc.stub(
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'a.dart'), _buf('b_2', 'b.dart')]
}));
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'a.dart'), _buf('b_2', 'b.dart')],
}),
);
ipc.stub(
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'}
}));
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'},
}),
);
ipc.stub('editor.read', (a) async {
final id = a['id'] as String;
return _ok(_read(id, id == 'b_1' ? 'a.dart' : 'b.dart', 'body-$id'));
@@ -253,15 +268,17 @@ void main() {
group('local edits', () {
test('pushLocalEdit marks the active buffer dirty and mirrors to IPC', () async {
ipc.stub(
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'a.dart')]
}));
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'a.dart')],
}),
);
ipc.stub(
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'}
}));
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'},
}),
);
ipc.stub('editor.read', (_) async => _ok(_read('b_1', 'a.dart', 'x')));
await c.hydrate();
@@ -281,15 +298,17 @@ void main() {
test('save() issues editor.save for the active buffer', () async {
ipc.stub(
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'a.dart')]
}));
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'a.dart')],
}),
);
ipc.stub(
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'}
}));
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'},
}),
);
ipc.stub('editor.read', (_) async => _ok(_read('b_1', 'a.dart', 'x')));
await c.hydrate();
@@ -316,15 +335,17 @@ void main() {
group('edge cases', () {
test('editor.active-changed to null clears the active buffer', () async {
ipc.stub(
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'a.dart')]
}));
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'a.dart')],
}),
);
ipc.stub(
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'}
}));
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'},
}),
);
ipc.stub('editor.read', (_) async => _ok(_read('b_1', 'a.dart', 'x')));
await c.hydrate();
expect(c.activeId, 'b_1');
@@ -358,15 +379,17 @@ void main() {
test('editor.opened with no id clears the active buffer', () async {
ipc.stub(
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'a.dart')]
}));
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'a.dart')],
}),
);
ipc.stub(
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'}
}));
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'},
}),
);
ipc.stub('editor.read', (_) async => _ok(_read('b_1', 'a.dart', 'x')));
await c.hydrate();
expect(c.activeId, 'b_1');
@@ -378,15 +401,17 @@ void main() {
test('a failing editor.read surfaces the error', () async {
ipc.stub(
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'a.dart')]
}));
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'a.dart')],
}),
);
ipc.stub(
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'}
}));
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'},
}),
);
ipc.stub(
'editor.read',
(_) async => IpcResponse.err(
@@ -400,15 +425,17 @@ void main() {
test('our own edit echo (editor.edited) is suppressed once, not reloaded', () async {
ipc.stub(
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'a.dart')]
}));
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'a.dart')],
}),
);
ipc.stub(
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'}
}));
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'},
}),
);
ipc.stub('editor.read', (_) async => _ok(_read('b_1', 'a.dart', 'original')));
ipc.stub('editor.set-content', (_) async => _ok(const {}));
await c.hydrate();
@@ -433,15 +460,17 @@ void main() {
group('editor settings (T-29)', () {
Future<void> hydrateWith(Map<String, Object?> read) async {
ipc.stub(
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'lib/a.dart')]
}));
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', 'lib/a.dart')],
}),
);
ipc.stub(
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'}
}));
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'},
}),
);
ipc.stub('editor.read', (_) async => _ok(read));
await c.hydrate();
}
+44 -38
View File
@@ -21,13 +21,13 @@ IpcResponse _ok(Map<String, Object?> data) => IpcResponse.ok(id: '', data: data)
Map<String, Object?> _buf(String id, String path, {bool dirty = false}) => {'id': id, 'path': path, 'dirty': dirty};
Map<String, Object?> _read(String id, String path, {Map<String, Object?>? settings}) => {
'id': id,
'path': path,
'content': 'content of $path',
'selection': {'start': 0, 'end': 0},
'dirty': false,
if (settings != null) 'editorSettings': settings,
};
'id': id,
'path': path,
'content': 'content of $path',
'selection': {'start': 0, 'end': 0},
'dirty': false,
'editorSettings': ?settings,
};
Finder _ruler() => find.byWidgetPredicate((w) => w is CustomPaint && w.painter?.runtimeType.toString() == '_RulerPainter');
@@ -40,12 +40,13 @@ void main() {
void stubBuffers(List<Map<String, Object?>> buffers, {String? active}) {
f.ipc.stub('editor.list', (_) async => _ok({'buffers': buffers}));
f.ipc.stub(
'editor.active',
(_) async => active == null
? _ok(const {})
: _ok({
'active': {'id': active}
}));
'editor.active',
(_) async => active == null
? _ok(const {})
: _ok({
'active': {'id': active},
}),
);
f.ipc.stub('editor.read', (a) async {
final id = a['id'] as String;
final b = buffers.firstWhere((b) => b['id'] == id);
@@ -147,15 +148,17 @@ void main() {
void stubOne(String path, {Map<String, Object?>? settings}) {
f.ipc.stub(
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', path)]
}));
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', path)],
}),
);
f.ipc.stub(
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'}
}));
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'},
}),
);
f.ipc.stub('editor.read', (_) async => _ok(_read('b_1', path, settings: settings)));
}
@@ -178,25 +181,28 @@ void main() {
void stubReadContent(String path, String content, Map<String, Object?> settings) {
f.ipc.stub(
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', path)]
}));
'editor.list',
(_) async => _ok({
'buffers': [_buf('b_1', path)],
}),
);
f.ipc.stub(
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'}
}));
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'},
}),
);
f.ipc.stub(
'editor.read',
(_) async => _ok({
'id': 'b_1',
'path': path,
'content': content,
'selection': {'start': 0, 'end': 0},
'dirty': false,
'editorSettings': settings
}));
'editor.read',
(_) async => _ok({
'id': 'b_1',
'path': path,
'content': content,
'selection': {'start': 0, 'end': 0},
'dirty': false,
'editorSettings': settings,
}),
);
f.ipc.stub('editor.set-content', (_) async => _ok(const {}));
}
@@ -41,26 +41,30 @@ void main() {
/// Pump a themed context, run [body] with a controller already
/// given tokens from the active theme.
Future<void> withController(
WidgetTester tester,
SyntaxTextController c,
Future<void> Function(BuildContext ctx) body,
) async {
Future<void> withController(WidgetTester tester, SyntaxTextController c, Future<void> Function(BuildContext ctx) body) async {
late BuildContext ctx;
await tester.pumpWidget(harness(f, Builder(builder: (context) {
ctx = context;
return const SizedBox();
})));
await tester.pumpWidget(
harness(
f,
Builder(
builder: (context) {
ctx = context;
return const SizedBox();
},
),
),
);
c.tokens = ClideTheme.of(ctx).surface;
await body(ctx);
}
testWidgets('renders highlighted spans as styled TextSpan children', (tester) async {
final c = SyntaxTextController(
syntax: _FakeSyntax(const [
SyntaxSpan(start: 0, end: 5, role: 'keyword'), // "class"
SyntaxSpan(start: 6, end: 9, role: 'type'), // "Foo"
]));
syntax: _FakeSyntax(const [
SyntaxSpan(start: 0, end: 5, role: 'keyword'), // "class"
SyntaxSpan(start: 6, end: 9, role: 'type'), // "Foo"
]),
);
await withController(tester, c, (ctx) async {
c.text = 'class Foo {}';
c.updatePath('a.dart');
@@ -76,9 +80,10 @@ void main() {
// '😀' is a surrogate pair (4 UTF-8 bytes). A span after it must
// still land on the right character offset.
final c = SyntaxTextController(
syntax: _FakeSyntax(const [
SyntaxSpan(start: 5, end: 8, role: 'type'), // "Foo" after "😀 "
]));
syntax: _FakeSyntax(const [
SyntaxSpan(start: 5, end: 8, role: 'type'), // "Foo" after "😀 "
]),
);
await withController(tester, c, (ctx) async {
c.text = '😀 Foo';
c.updatePath('a.dart');
+3 -3
View File
@@ -8,9 +8,9 @@ import 'package:flutter/services.dart' show TextEditingValue, TextSelection;
import 'package:flutter_test/flutter_test.dart';
TextEditingValue _tev(String text, int caret, {int? anchor}) => TextEditingValue(
text: text,
selection: TextSelection(baseOffset: anchor ?? caret, extentOffset: caret),
);
text: text,
selection: TextSelection(baseOffset: anchor ?? caret, extentOffset: caret),
);
void main() {
group('motions', () {
+21 -18
View File
@@ -22,26 +22,29 @@ void main() {
void stubOneBuffer(String content) {
f.ipc.stub(
'editor.list',
(_) async => _ok({
'buffers': [
{'id': 'b_1', 'path': 'lib/a.dart', 'dirty': false}
]
}));
'editor.list',
(_) async => _ok({
'buffers': [
{'id': 'b_1', 'path': 'lib/a.dart', 'dirty': false},
],
}),
);
f.ipc.stub(
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'}
}));
'editor.active',
(_) async => _ok({
'active': {'id': 'b_1'},
}),
);
f.ipc.stub(
'editor.read',
(_) async => _ok({
'id': 'b_1',
'path': 'lib/a.dart',
'content': content,
'selection': {'start': 0, 'end': 0},
'dirty': false,
}));
'editor.read',
(_) async => _ok({
'id': 'b_1',
'path': 'lib/a.dart',
'content': content,
'selection': {'start': 0, 'end': 0},
'dirty': false,
}),
);
}
Future<void> pumpEditor(WidgetTester tester) async {