[asset_transformers] Provide the current target platform in the asset transformer
- Dominant language
- Dart
- Stars
- 179k
- Forks
- 31.1k
- PR merge metrics
- PR metrics pending
Description
### Use case
Developers wanting to transform assets, based on the current target platform (i.e. `flutter build web` -> web; `flutter build apk` -> android), currently cannot infer the target platform during the asset transformation.
### Proposal
I propose that the target platform of the `flutter build` invocation is provided as either an argument, or in `Platform.environment`. I initially tried checking what is inside `Platform.environment` and the `FLUTTER_BUILD_MODE` seems to be there already?
Then I think the easiest thing to do is to also add something like `FLUTTER_BUILD_TARGET_PLATFORM` to `Platform.environment` or the args that are passed to the asset transformer, whichever makes more sense / is cleaner from a tool perspective.
Context: I was initially exploring if I could work around the absence of https://github.com/flutter/flutter/issues/141371 using an asset transformer
Contributor guide
Assessment
This issue has not been assessed yet.