mirror of
https://github.com/flutter/flutter.git
synced 2025-06-03 00:51:18 +00:00
![]() This PR adds support invoking `link.dart` hooks. Link hooks can add new assets. Link hooks can transform assets sent to link hook from build hooks. This PR does not yet add support for getting tree-shake information in the link hooks. This is pending on defining the `resources.json` format (https://github.com/dart-lang/sdk/issues/55494). Issue: * https://github.com/flutter/flutter/issues/146263 ## Implementation considerations The build hooks could be run before Dart compilation and the link hooks after Dart compilation. (This is how it's done in Dart standalone.) However, due to the way the `Target`s are set up, this would require two targets and serializing and deserializing the `BuildResult` in between these. This would lead to more code but no benefits. Currently there is nothing that mandates running build hooks before Dart compilation. ## Testing * The unit tests verify that the native_assets_builder `link` and `linkDryRun` would be invoked with help of the existing fake. * The native assets integration test now also invokes an FFI call of a package that adds the asset during the link hook instead of the build hook. * In order to keep coverage of the `flutter create --template=package_ffi`, `flutter create` is still run and the extra dependency is added and an extra ffi call is added. (Open to alternative suggestions.) |
||
---|---|---|
.. | ||
app | ||
app_integration_test/integration_test | ||
app_shared | ||
app_test_widget/test | ||
cocoapods | ||
module | ||
package | ||
package_ffi | ||
plugin | ||
plugin_cocoapods | ||
plugin_ffi | ||
plugin_shared | ||
plugin_swift_package_manager | ||
skeleton | ||
xcode/ios/custom_application_bundle | ||
README.md | ||
template_manifest.json |
This directory contains templates for flutter create
.
The *_shared
subdirectories provide files for multiple templates.
app_shared
forapp
andskeleton
.plugin_shared
for (method channel)plugin
andplugin_ffi
.
For example, there are two app templates: app
(the counter app)
and skeleton
(the more advanced list view/detail view app).
┌────────────┐
│ app_shared │
└──┬──────┬──┘
│ │
│ │
▼ ▼
┌─────┐ ┌──────────┐
│ app │ │ skeleton │
└─────┘ └──────────┘
Thanks to app_shared
, the templates for app
and skeleton
can contain
only the files that are specific to them alone, and the rest is automatically
kept in sync.