-
Notifications
You must be signed in to change notification settings - Fork 28.9k
Description
description
While backing up some build results in an git-ignored project folder, i encountered an annoying bug with regard to assets. The mentioned folder was included in the next flutter build windows
output in the flutter_assets
folder, despite not being specified in the pubspec.yaml
as assets folder. I could also reproduce this in a newly created project.
steps to reproduce
flutter create test_assets
- Create a folder
test_dir
, create a fileCHANGELOG.md
- pubspec.yaml
name: test_assets
description: A new Flutter project.
publish_to: 'none' # Remove this line if you wish to publish to pub.dev
version: 1.0.0+1
environment:
sdk: '>=2.18.2 <3.0.0'
dependencies:
flutter:
sdk: flutter
cupertino_icons: ^1.0.2
dev_dependencies:
flutter_test:
sdk: flutter
flutter_lints: ^2.0.0
flutter:
uses-material-design: true
assets:
- assets/
- CHANGELOG.md
flutter build windows
- copy
build/windows/runner/Release
totest_dir
flutter build windows
- now you can find a file
...\test_assets\build\windows\runner\Release\data\flutter_assets\test_dir\Release\data\flutter_assets\CHANGELOG.md
in the build results.
This would increases the app size with every build, despite the test_dir
folder not being specified as assets folder.
expected result
- the
test_dir
folder is not included in theflutter_assets
.
remarks
It looks like the cause for this is, that there is a CHANGELOG.md
file found in the test_dir
folder, and this filename is specified in the assets in the pubspec.yaml. But the intention is the inclusion of the top level test_assets/CHANGELOG.md
file. Replacing the assets paragraph in the pubspec.yaml with relative paths does not fix the problem, unfortunally:
assets:
- ./assets/
- ./CHANGELOG.md
environment
Target Platform: windows
Flutter version: 3.3.5
flutter doctor
output:
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.3.5, on Microsoft Windows [Version 10.0.19045.2251], locale de-DE)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.1.0-rc1)
[✓] Chrome - develop for the web
[✓] Visual Studio - develop for Windows (Visual Studio Community 2022 17.0.5)
[✓] Android Studio (version 2021.3)
[✓] VS Code (version 1.73.1)
[✓] Connected device (3 available)
[✓] HTTP Host Availability
• No issues found!