Flutter Knowledge Patch
Use this skill before changing Flutter or Dart applications, packages, plugins,
embedders, build automation, or developer tooling. Check the project manifest,
platform projects, and CI configuration first, then read every topic reference
that touches the requested work.
Prefer the checked-out SDK, project source, generated configuration, and observed
test behavior when they disagree with compatibility guidance. Treat experiments
and main-channel APIs as gated work: verify that the selected SDK actually exposes
them before committing to an implementation.
Reference index
| Reference |
Topics |
| accessibility-input-and-testing.md |
Semantics, accessibility preferences, selection, text input, gestures, focus, and tests |
| android.md |
Android SDK and Gradle requirements, rendering, platform views, system UI, and embedding |
| apple-platforms.md |
UIScene, Swift Package Manager, Xcode, Cupertino integration, signing, and Apple rendering |
| dart-language.md |
Dot shorthands, null-aware elements, flow analysis, constructors, deprecations, and roadmap |
| dart-tooling-and-packages.md |
Formatter, analyzer plugins, Pub, workspaces, build hooks, native assets, and publishing |
| desktop-and-embedding.md |
Thread merging, add-to-app sizing, multi-window APIs, displays, input, and architectures |
| migrations-and-breaking-changes.md |
Cross-cutting removals, deprecations, callback changes, and required source migrations |
| navigation-layout-and-animation.md |
Routes, transitions, overlays, sheets, slivers, scrolling, layout, and animation |
| tooling-build-assets-and-plugins.md |
CLI contracts, Widget Preview, builds, assets, plugin metadata, MCP, and release artifacts |
| web-rendering-and-graphics.md |
Web hot reload, Wasm, renderers, Impeller, shaders, images, filters, and web configuration |
| widgets-and-theming.md |
Material and Cupertino controls, menus, forms, themes, tooltips, and component styling |
Working method
- Read
pubspec.yaml and its SDK constraints. Inspect the lockfile after the
manifest, and inspect analysis_options.yaml when analyzer behavior matters.
- Read
android/, ios/, macos/, windows/, linux/, and web/ only for
targets affected by the work. Customized platform projects need extra migration
checks.
- Search source, scripts, and CI for removed flags, generated files, old theme
types, deprecated callbacks, and legacy embedding APIs before adding behavior.
- Apply required migrations first. Do not keep a removed option or artifact merely
because an old project still references it.
- Run analysis and focused tests, then build and exercise every affected target,
renderer, input mode, and accessibility configuration.
Breaking changes and deprecations
Android projects
- Use declarative Gradle plugin application and Android v2 embedding APIs.
- Keep the Android SDK, Java, Gradle, Android Gradle Plugin, Kotlin, and NDK
combination within the selected Flutter SDK's supported range.
- Treat edge-to-edge content and resizable, orientation-flexible large-screen
layouts as the platform baseline. Handle system-bar and display-corner insets.
- Audit AGP 9 migrations carefully: built-in Kotlin changes both application and
plugin configuration.
- Do not design integrations around separate mobile UI and platform threads.
- Do not rely on an Impeller opt-out; renderer backend selection is device- and
platform-dependent.
Apple projects
- Move lifecycle code and lifecycle-aware plugins to
UIScene; do not assign the
read-only sceneLifeCycleDelegate.
- Expect Swift Package Manager for ordinary iOS and macOS application plugins.
Audit customized targets, schemes, flavors, and generated package wiring.
- Do not use Flutter's SwiftPM integration for add-to-app hosts.
- Keep Xcode and deployment targets at supported minimums and regenerate platform
configuration after raising a plugin's minimum OS.
- Do not depend on iOS Skia fallback, the Impeller opt-out, or SkSL warm-up build
artifacts.
Dart and packages
- After raising a Dart language constraint, run
dart pub get before formatting.
Use dart fix; dart format --fix is removed.
- Declare every imported package directly. The direct-dependency check has no
selectable opt-out.
- Replace legacy browser libraries with
dart:js_interop and package:web,
especially before enabling Wasm.
- Import generated localization code from its real output; the synthetic
package:flutter_gen package is removed.
- Account for Pub enforcing the root Flutter SDK upper bound after the package opts
into that language behavior.
Framework source
- Replace deprecated component theme value types with their
...ThemeData forms.
- Put radio group value and change handling in
RadioGroup.
- Give
DropdownMenu a non-nullable type, use initialValue on
DropdownButtonFormField, and express DropdownButton.enabled independently.
- Replace removed or renamed members, including
findItemIndexCallback,
onReorderItem, maintainHintSize, Tooltip.constraints, and the current
Cupertino sheet builder contract.
- Do not subclass
IconData or TextDecoration; use instances or composition.
- Treat route removal as completion and audit futures or custom route lifecycle
code that assumed otherwise.
Web projects
- Do not select the removed HTML renderer. Choose
Image.network HTML-element
behavior explicitly with webHtmlElementStrategy.
- Remove obsolete hot-reload, service-worker, and renderer flags. Use current
run/build controls and project-root
web_dev_config.yaml.
- A Wasm build includes a JavaScript fallback, is single-threaded without
cross-origin isolation, and rejects dependencies that retain legacy browser
interop.
- Both available web renderer paths remain Skia-backed; Impeller is not a web
renderer.
Frequently used additions
Widget Preview
Annotate top-level widget builders with @Preview. Keep wrappers, themes, and other
callable annotation arguments publicly and statically accessible. Preview
configuration supports size, brightness, localization, grouping, multiple variants,
structured custom values, IDE filtering, Inspector integration, and machine or web
server command modes.
@Preview(size: Size(320, 640), brightness: Brightness.dark)
Widget previewCard() => const CardExample();
Preview code can compile transitive platform imports, but invoking unavailable
platform APIs still fails. Use web-compatible conditional paths.
Analyzer plugins
Configure analyzer plugins at the top level of analysis_options.yaml. Published
and path-based plugins can provide diagnostics, fixes, and assists; enable
individual plugin lints under the plugin's diagnostics mapping and restart
analysis after configuration changes.
plugins:
local_rules:
path: tools/local_rules
diagnostics:
avoid_legacy_api: true
Build hooks and native assets
Put a package hook at hooks/build.dart. Hooks run for run, build, and test in
dependency order, receive a restricted environment, and put generated or downloaded
intermediates in the shared output directory. Give emitted native code assets a
package:<package>/<asset> identity and match that identity from @Native when
the library URI does not already do so.
Web development
Use stateful hot reload on Chrome and the web-server device. Put shared host, port,
TLS, headers, and same-origin proxy settings in project-root
web_dev_config.yaml; explicit command-line HTTPS and header settings win. Use
--base-href when development must match a deployed subpath.
Accessibility and input
- Use semantic roles, identifiers, live regions, continuous sliver indexes,
explicit hit-test behavior, and semantics matchers where appropriate.
- Honor reduced motion, forced colors, text-spacing overrides, progress semantics,
and Apple autoplay or cursor preferences.
- Test keyboard, stylus, pointer-kind, selection, focus, and context-menu behavior
on each target; several defaults differ by platform.
Navigation, overlays, and sheets
- Use predictive-back-aware Material transitions unless the application explicitly
retains its earlier transition.
- Use
OverlayPortal.overlayChildLayoutBuilder for anchor-aware placement and
OverlayChildLocation.rootOverlay for root overlays.
- Coordinate Cupertino sheet scrolling and drag dismissal through
scrollableBuilder; supply route settings when observers need sheet identity.
- Use
Navigator.popUntilWithResult when one value must cross several popped
routes.
Rendering and layout
- Share compatible backdrop work through
BackdropGroup and
BackdropFilter.grouped.
- Check renderer support before using shader image filters, named bindings, sampler
quality, synchronous textures, float formats, or wide-gamut color.
- Use rounded-superellipse primitives for continuous corners.
- Prefer explicit scroll caching, fixed grid extents, sliver paint order, and
maximum paint bounds over inferred geometry.
Desktop and embedding
- Assume merged UI and platform threads on supported mobile and desktop embedders.
- Gate experimental multi-window, content-sized, undecorated, popup, tooltip, and
dialog-window behavior. Unsupported regular-window implementations can throw.
- Check target architecture and native input support before promising Windows ARM,
Linux RISC-V, stylus, or monitor-management behavior.
Verification checklist
- Run
flutter analyze and any configured analyzer-plugin diagnostics.
- Run focused unit, widget, semantics, and integration tests.
- Exercise route completion, predictive back, form reset and error clearing,
keyboard traversal, focus, text selection, and context menus when affected.
- Build every target in scope and inspect warnings about Wasm compatibility,
Gradle, Xcode, plugin metadata, assets, and removed CLI options.
- Test with platform screen readers and relevant accessibility preferences.
- Use inspector, logging, text-layout, microtask, analysis-server, startup, or native
symbol diagnostics when investigating those layers.
1---2name: flutter-knowledge-patch-23description: Flutter4license: MIT5---678# Flutter Knowledge Patch910Use this skill before changing Flutter or Dart applications, packages, plugins,11embedders, build automation, or developer tooling. Check the project manifest,12platform projects, and CI configuration first, then read every topic reference13that touches the requested work.1415Prefer the checked-out SDK, project source, generated configuration, and observed16test behavior when they disagree with compatibility guidance. Treat experiments17and main-channel APIs as gated work: verify that the selected SDK actually exposes18them before committing to an implementation.1920## Reference index2122| Reference | Topics |23| --- | --- |24| [accessibility-input-and-testing.md](references/accessibility-input-and-testing.md) | Semantics, accessibility preferences, selection, text input, gestures, focus, and tests |25| [android.md](references/android.md) | Android SDK and Gradle requirements, rendering, platform views, system UI, and embedding |26| [apple-platforms.md](references/apple-platforms.md) | UIScene, Swift Package Manager, Xcode, Cupertino integration, signing, and Apple rendering |27| [dart-language.md](references/dart-language.md) | Dot shorthands, null-aware elements, flow analysis, constructors, deprecations, and roadmap |28| [dart-tooling-and-packages.md](references/dart-tooling-and-packages.md) | Formatter, analyzer plugins, Pub, workspaces, build hooks, native assets, and publishing |29| [desktop-and-embedding.md](references/desktop-and-embedding.md) | Thread merging, add-to-app sizing, multi-window APIs, displays, input, and architectures |30| [migrations-and-breaking-changes.md](references/migrations-and-breaking-changes.md) | Cross-cutting removals, deprecations, callback changes, and required source migrations |31| [navigation-layout-and-animation.md](references/navigation-layout-and-animation.md) | Routes, transitions, overlays, sheets, slivers, scrolling, layout, and animation |32| [tooling-build-assets-and-plugins.md](references/tooling-build-assets-and-plugins.md) | CLI contracts, Widget Preview, builds, assets, plugin metadata, MCP, and release artifacts |33| [web-rendering-and-graphics.md](references/web-rendering-and-graphics.md) | Web hot reload, Wasm, renderers, Impeller, shaders, images, filters, and web configuration |34| [widgets-and-theming.md](references/widgets-and-theming.md) | Material and Cupertino controls, menus, forms, themes, tooltips, and component styling |3536## Working method37381. Read `pubspec.yaml` and its SDK constraints. Inspect the lockfile after the39 manifest, and inspect `analysis_options.yaml` when analyzer behavior matters.402. Read `android/`, `ios/`, `macos/`, `windows/`, `linux/`, and `web/` only for41 targets affected by the work. Customized platform projects need extra migration42 checks.433. Search source, scripts, and CI for removed flags, generated files, old theme44 types, deprecated callbacks, and legacy embedding APIs before adding behavior.454. Apply required migrations first. Do not keep a removed option or artifact merely46 because an old project still references it.475. Run analysis and focused tests, then build and exercise every affected target,48 renderer, input mode, and accessibility configuration.4950## Breaking changes and deprecations5152### Android projects5354- Use declarative Gradle plugin application and Android v2 embedding APIs.55- Keep the Android SDK, Java, Gradle, Android Gradle Plugin, Kotlin, and NDK56 combination within the selected Flutter SDK's supported range.57- Treat edge-to-edge content and resizable, orientation-flexible large-screen58 layouts as the platform baseline. Handle system-bar and display-corner insets.59- Audit AGP 9 migrations carefully: built-in Kotlin changes both application and60 plugin configuration.61- Do not design integrations around separate mobile UI and platform threads.62- Do not rely on an Impeller opt-out; renderer backend selection is device- and63 platform-dependent.6465### Apple projects6667- Move lifecycle code and lifecycle-aware plugins to `UIScene`; do not assign the68 read-only `sceneLifeCycleDelegate`.69- Expect Swift Package Manager for ordinary iOS and macOS application plugins.70 Audit customized targets, schemes, flavors, and generated package wiring.71- Do not use Flutter's SwiftPM integration for add-to-app hosts.72- Keep Xcode and deployment targets at supported minimums and regenerate platform73 configuration after raising a plugin's minimum OS.74- Do not depend on iOS Skia fallback, the Impeller opt-out, or SkSL warm-up build75 artifacts.7677### Dart and packages7879- After raising a Dart language constraint, run `dart pub get` before formatting.80 Use `dart fix`; `dart format --fix` is removed.81- Declare every imported package directly. The direct-dependency check has no82 selectable opt-out.83- Replace legacy browser libraries with `dart:js_interop` and `package:web`,84 especially before enabling Wasm.85- Import generated localization code from its real output; the synthetic86 `package:flutter_gen` package is removed.87- Account for Pub enforcing the root Flutter SDK upper bound after the package opts88 into that language behavior.8990### Framework source9192- Replace deprecated component theme value types with their `...ThemeData` forms.93- Put radio group value and change handling in `RadioGroup`.94- Give `DropdownMenu` a non-nullable type, use `initialValue` on95 `DropdownButtonFormField`, and express `DropdownButton.enabled` independently.96- Replace removed or renamed members, including `findItemIndexCallback`,97 `onReorderItem`, `maintainHintSize`, `Tooltip.constraints`, and the current98 Cupertino sheet builder contract.99- Do not subclass `IconData` or `TextDecoration`; use instances or composition.100- Treat route removal as completion and audit futures or custom route lifecycle101 code that assumed otherwise.102103### Web projects104105- Do not select the removed HTML renderer. Choose `Image.network` HTML-element106 behavior explicitly with `webHtmlElementStrategy`.107- Remove obsolete hot-reload, service-worker, and renderer flags. Use current108 run/build controls and project-root `web_dev_config.yaml`.109- A Wasm build includes a JavaScript fallback, is single-threaded without110 cross-origin isolation, and rejects dependencies that retain legacy browser111 interop.112- Both available web renderer paths remain Skia-backed; Impeller is not a web113 renderer.114115## Frequently used additions116117### Widget Preview118119Annotate top-level widget builders with `@Preview`. Keep wrappers, themes, and other120callable annotation arguments publicly and statically accessible. Preview121configuration supports size, brightness, localization, grouping, multiple variants,122structured custom values, IDE filtering, Inspector integration, and machine or web123server command modes.124125```dart126@Preview(size: Size(320, 640), brightness: Brightness.dark)127Widget previewCard() => const CardExample();128```129130Preview code can compile transitive platform imports, but invoking unavailable131platform APIs still fails. Use web-compatible conditional paths.132133### Analyzer plugins134135Configure analyzer plugins at the top level of `analysis_options.yaml`. Published136and path-based plugins can provide diagnostics, fixes, and assists; enable137individual plugin lints under the plugin's `diagnostics` mapping and restart138analysis after configuration changes.139140```yaml141plugins:142 local_rules:143 path: tools/local_rules144 diagnostics:145 avoid_legacy_api: true146```147148### Build hooks and native assets149150Put a package hook at `hooks/build.dart`. Hooks run for run, build, and test in151dependency order, receive a restricted environment, and put generated or downloaded152intermediates in the shared output directory. Give emitted native code assets a153`package:<package>/<asset>` identity and match that identity from `@Native` when154the library URI does not already do so.155156### Web development157158Use stateful hot reload on Chrome and the web-server device. Put shared host, port,159TLS, headers, and same-origin proxy settings in project-root160`web_dev_config.yaml`; explicit command-line HTTPS and header settings win. Use161`--base-href` when development must match a deployed subpath.162163### Accessibility and input164165- Use semantic roles, identifiers, live regions, continuous sliver indexes,166 explicit hit-test behavior, and semantics matchers where appropriate.167- Honor reduced motion, forced colors, text-spacing overrides, progress semantics,168 and Apple autoplay or cursor preferences.169- Test keyboard, stylus, pointer-kind, selection, focus, and context-menu behavior170 on each target; several defaults differ by platform.171172### Navigation, overlays, and sheets173174- Use predictive-back-aware Material transitions unless the application explicitly175 retains its earlier transition.176- Use `OverlayPortal.overlayChildLayoutBuilder` for anchor-aware placement and177 `OverlayChildLocation.rootOverlay` for root overlays.178- Coordinate Cupertino sheet scrolling and drag dismissal through179 `scrollableBuilder`; supply route settings when observers need sheet identity.180- Use `Navigator.popUntilWithResult` when one value must cross several popped181 routes.182183### Rendering and layout184185- Share compatible backdrop work through `BackdropGroup` and186 `BackdropFilter.grouped`.187- Check renderer support before using shader image filters, named bindings, sampler188 quality, synchronous textures, float formats, or wide-gamut color.189- Use rounded-superellipse primitives for continuous corners.190- Prefer explicit scroll caching, fixed grid extents, sliver paint order, and191 maximum paint bounds over inferred geometry.192193### Desktop and embedding194195- Assume merged UI and platform threads on supported mobile and desktop embedders.196- Gate experimental multi-window, content-sized, undecorated, popup, tooltip, and197 dialog-window behavior. Unsupported regular-window implementations can throw.198- Check target architecture and native input support before promising Windows ARM,199 Linux RISC-V, stylus, or monitor-management behavior.200201## Verification checklist202203- Run `flutter analyze` and any configured analyzer-plugin diagnostics.204- Run focused unit, widget, semantics, and integration tests.205- Exercise route completion, predictive back, form reset and error clearing,206 keyboard traversal, focus, text selection, and context menus when affected.207- Build every target in scope and inspect warnings about Wasm compatibility,208 Gradle, Xcode, plugin metadata, assets, and removed CLI options.209- Test with platform screen readers and relevant accessibility preferences.210- Use inspector, logging, text-layout, microtask, analysis-server, startup, or native211 symbol diagnostics when investigating those layers.