If you check the links in the browser, both and are available but there is no build/web/assets/file.json file in the project folder. ![]() I am not sure why your example works with flutter run -d chrome -dart-define=FLUTTER_WEB_USE_SKIA=true -release, my guess would be that the flutter web server serves from the project folder and finds the file under the assets folder. ![]() The same is true with your initial example, the file.json will be available under build/web/assets/assets/file.json but you reference it only by file.json in main.dart instead of assets/file.json It is just another folder that happens to be called assets.įor example if you move the file.json file to the data folder and only reference it by file.json in pubspec.yaml, instead of data/file.json, flutter will find the file and copy it to build/web/assets but keeps the folder structure relative to pubspec.yaml so it will be under build/web/assets/data/file.json. The assets folder is not a special folder in the project structure. ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |