Skip to content

Flutter error

Flutter: “Unable to load asset”

An image or file doesn’t show, and the log says Unable to load asset: "assets/images/logo.png", often followed by The asset does not exist or has empty data. Flutter bundles only the files listed under flutter: assets: in pubspec.yaml, and finds them by the exact path the code asks for. One of those two doesn’t match the file on disk.

Rather hand it over? App Fix Ticket: One reproducible bug in an existing mobile or web app, diagnosed and fixed.The Fix is $1,200 in total. The $450 Diagnosis is optional and credited toward it.

Full refund if Simon can’t take it on once he sees your project, or if you cancel before work starts. Refund terms.

Short answer

Check, in order: the file is listed in pubspec.yaml under flutter: assets: (a folder entry ends in / and covers that folder only, not its subfolders); the path in Image.asset() points at a real file under that entry, with the same capitals; and the assets: line is indented two spaces under flutter:. After changing pubspec.yaml, stop the app and run it again. For an asset that ships inside a package, pass package: 'package_name' to Image.asset.

Rather not fix it yourself? App Fix Ticket fixes one reproducible bug at a fixed price, with an optional Diagnosis that is credited toward the fix.

Why Flutter can’t find the file, and the fix

  1. 01

    The file isn’t listed in pubspec.yaml

    “Each asset is identified by an explicit path (relative to the pubspec.yaml file) where the asset file is located.” Flutter, Adding assets and images

    Copying a file into the project folder isn’t enough. Every asset needs a line under flutter: assets:, either for the file itself or for its folder. A folder entry must end in /: - assets/images without it is read as a file.

    flutter:
      assets:
        - assets/images/
        - assets/data/config.json
  2. 02

    It sits in a subfolder of a listed folder

    “Only files located directly in the directory are included. Resolution-aware asset image variants are the only exception. To add files located in subdirectories, create an entry per directory.” Flutter, Adding assets and images

    assets/images/ includes assets/images/logo.png, but not assets/images/icons/home.png. Add a line for each subfolder.

  3. 03

    The path in the code doesn’t match

    Image.asset('Assets/Logo.png') looks for a different file than assets/logo.png. Copy the path from pubspec.yaml into the code, with no leading slash or ./, and check the file name’s capitals and extension (.png and .PNG differ).

  4. 04

    pubspec.yaml is indented wrongly

    “The assets: line should be indented by exactly two spaces below the flutter: line” Flutter, Adding assets and images

    YAML reads structure from spaces. If assets: isn’t indented under flutter:, the list is ignored or the build reports that it can’t find the folder.

Checked against the vendor’s docs on : Flutter: Adding assets and images.

Rather hand it over?

Fixed scope, fixed price, paid upfront. The work happens in writing; no call needed.

“Very responsive, attentive to fixing bugs, and completed the project as needed! Thank you!”
A buyer in the United States, July 2022. Shopify on Fiverr
Read 126 of the 127 Fiverr reviews

Related: Flutter web “XMLHttpRequest error” · Flutter “version solving failed” · Flutter “A RenderFlex overflowed” · React Native unable to load script

Questions

More on this error

Do I need to list every image?

No. List each folder once, ending in /. Files in its subfolders need their own folder line.

It works on my machine but not in the CI build. Why?

Check that the asset files are committed. A file listed in .gitignore, or added locally and never pushed, isn’t in the checkout CI builds from, so it isn’t bundled.

Can you fix it for me?

If one bug is the whole problem, the App Fix Ticket covers it. If you already know the cause, you can pay for the fix directly; if not, start with a written diagnosis, which is credited toward the fix. If the app has more going on, the Launch Check is a written check of the whole app. Each issue found is rated critical, high, medium or low, with where it is and how it was confirmed. No issues worth fixing, no charge. If the Launch Check finds nothing rated medium or higher, Simon refunds the full $450. You keep the report either way. This applies to the first 10 Launch Checks bought after October 30, 2026.

A different error?

Ask Simon for a price range

Send the error and what you were doing. Simon replies by email, usually within one business day, with a price range.