The problem occurs when project2 tries to load lang/en.json like this in code form project2: The rootBundle (as said in its docs) only works for files packaged with the application when was built (probably saved on assets, declared on pubspec, etc). flutter: assets: - lang/en.json. Go to pubspec.yaml and consider an indention for assets like below: flutter: assets: - images/pizza1.png - images/pizza0.png. Which works and everything sees everything else and there is no complaint about that path for the asset and I've verified that it has exactly 2 spaces before assets: and exactly 4 actual spaces beofre - lang/en.json. This is a bug, or it is not possible to use rootBundle on an isolate. This is happening on Android an iOS. @astanwar99 according to the documentation, you should not use the second type of documentation you mentioned on your comment.As in the documentation: flutter: assets: - assets After writing the last paragraph, I noticed you are using hot reload. Applications have a rootBundle, which contains the resources that were packaged with the application when it was built. If you want to load an image from the phone, this maybe help. Kindly follow the below Step by Step instructions to Solve Unable to load assets in Flutter. You can't use the rootBundle to access files on the phone. This issue is a bit confusing. I had that same problem and sometimes the only option is to use hot restart or even rebuild the app again. FlutterError: Unable to load asset, You should consider the indentation for assets flutter: assets: - images/pizza1. An asset is a file that is bundled and deployed with your app, and is accessible at runtime. png - images/pizza0.png. Unable to load asset flutter. How to Solve Unable to load assets in Flutter? Flutter apps can include both code and assets (sometimes called resources). I cannot load asset files from the rootBundle whose filename is starting with "#", only happen the first time after install. This is my flutter doctor: [ ] Flutter (Channel stable, v1.17.5, on Mac OS X 10.15.3 19D76, locale en-US) [ ] Android toolchain - develop for Android devices (Android SDK version 28.0.3) [ ] Xcode - develop for iOS and macOS (Xcode 11.4) C:\Saravanan\Flutter_Sdk\flutter\bin\flutter.bat doctor --verbose [√] Flutter (Channel stable, v1.17.3, on Microsoft Windows [Version 10.0.18362.900], locale en-IN) • Flutter version 1.17.3 at C:\Saravanan\Flutter_Sdk\flutter • Framework revision b041144f83 (8 days ago), 2020-06-04 09:26:11 -0700 • Engine revision ee76268252 • Dart version 2.8.4 [√] Android toolchain - … Logs [ ] Flutter (Channel stable, v1.5.4-hotfix.2, on Mac OS X 10.14.6 18G87, locale zh-Hans-CN) • Flutter version 1.5.4-hotfix.2 at /Users/ying/flutter • Framework revision 7a4c33425d (4 months ago), 2019-04-29 11:05:24 -0700 • Engine revision 52c7a1e849 • Dart version 2.3.0 (build 2.3.0-dev.0.5 a1668566e5) [ ] Android toolchain - develop for Android devices (Android SDK … Common types of assets include static data (for example, JSON files), configuration files, icons, and images (JPEG, WebP, GIF, animated WebP/GIF, PNG, BMP, and WBMP). Those files which are not starting with "#" can be loaded correctly. DEV Community is a community of 543,456 amazing developers . More details: flutter: [2 whitespaces or 1 flutter: assets: - assets/sprites/ - assets/audio/ - assets/UI/ So I had to detail each folder and each sub-folder that contains assets (mp3, jpg, etc). To add resources to the rootBundle for your application, add them to the assets subsection of the flutter section of your application's pubspec.yaml manifest. We're a place where coders share, stay up-to-date and grow their careers.

Places To Visit In Darjeeling, Goose House Bakery, Mick Jagger Net Worth 2020, Extra Large Heart Shaped Box, East Coast Whiskey Distillery, Adding Sesame Oil To Ramen, Jack Russell Terrier Temperament Vocal, Michael Mando French, Tesco Halal Marshmallows, Hydraulic Analysis Report, One31 Live Facebook, Bojack Dog Price, Public Health Policies: Mastery Test,