$ the-wire · showcase
Flutter tool DI migration lands Doctor and Channel commands
By RepoJournal · Filed · About Mobile platforms
The Flutter tool's modular dependency injection migration reaches the Doctor and Channel commands, removing ambient access from FlutterCommand.
Flutter tooling continues its modular dependency injection migration: `ChannelCommand` and `DoctorCommand` now use explicit constructor injection via `ToolContext`, removing ambient access from `FlutterCommand` and gaining hermetic unit tests [1][2]. Those are breaking changes for internal tool code, not for app developers. Separately, RawScrollbar gains a `mouseCursor` property that resolves states like `WidgetState.hovered`, `WidgetState.dragged`, and `WidgetState.disabled` [3]. FadeInImage adds `FadeInImageTransition.sequential` (default) and `FadeInImageTransition.fadeInOver`; the latter fades the image in on top of the placeholder, which stays at full opacity until the image finishes loading [4]. An Android crash is fixed: when an Activity is destroyed while a texture producer has a frame in flight, the `onImage` callback can run after FlutterJNI detaches, and the guard prevents `scheduleEngineFrame` from raising `RuntimeException: Cannot execute operation because FlutterJNI is not attached to native.` [5]. In Swift, a borrow accessor call on a guaranteed 'self' now forms a lifetime dependency on the borrowed root, handling structs containing class instances with 'let' values [6]. Subtyping checks gain handling for sync vs async differences and function types [7]. Kotlin's Swift Export fixes sealedType functions by using type checks as fallback, addressing KT-88999 [8].
Action items
- → Review Flutter tool code affected by ChannelCommand/DoctorCommand constructor changes flutter/flutter [plan]
- → Test apps using FadeInImage with the new transition parameter flutter/flutter [plan]
- → Verify Android apps no longer crash when Activity is destroyed during frame in flight flutter/flutter [plan]
References
- [1] [tool] Migrate ChannelCommand to modular dependency injection (#190751) ↗ flutter/flutter
- [2] [tool] Migrate DoctorCommand to modular dependency injection (#190758) ↗ flutter/flutter
- [3] Add mouseCursor to RawScrollbar (#185750) ↗ flutter/flutter
- [4] Add FadeInImageTransition.fadeInOver to fade the image in over the placeholder (#186246) ↗ flutter/flutter
- [5] [Android] Do not schedule engine frames on a detached FlutterJNI (#191204) ↗ flutter/flutter
- [6] [Lifetimes] Form a lifetime dependency on the guaranteed base of a borrow accessor call ↗ apple/swift
- [7] Sema: Minor improvements to subtyping checks ↗ apple/swift
- [8] [Swift Export] Use type checks as fallback for sealedType functions ↗ JetBrains/kotlin