I've created a package, which uses some assets (sf2 file, ttf files, etc). Assets don't seem to load. I can fix this by including these files in the assets folder of my main project (so now, every asset in the package is also in my main project). However, when I build a web app, it still creates an extra folder for my package with the files that it needs.

Is there a way around this? How do I enforce the package to use the assets from itself?


Solution 1: mirkancal

After some digging, I've found a way to include it.

'packages/livescore_sdk/assets/default_team_logo.png' works instead of 'assets/default_team_logo.png'


Solution 2: Jesus Hernandez Barrios

Include the assets in your lib folder, and import it from local project only.

Assuming the project name ABC:

Steps
  1. Create assets folder in lib, example: lib/assets. Full assets example url: ABC/lib/assets/some_asset.png
  2. Copy the assets in this folder.
  3. Import the assets in your pubspec.yaml like this:
  assets:
    - packages/ABC/assets/some_asset.png

Hope this help someone. :smiley: