Asset Images not showing up in FLutter Web when doing flutter run -- release
Asked Answered
J

1

6

When I was trying to execute my flutter project as

flutter run

The screenshot is the display

this is how it displays with flutter run

All the assets display as intended.

But when I use

flutter run --release

The screenshot is the display

this is how it displays with flutter run -- release

No asset displays and blank stuff is displayed instead

I have tried most fixes already available but nothing worked so far. I have put changed the image's location to be outside the assets folder but still no luck.


Pubspec.yaml

name: portfolio
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.12.0 <3.0.0"

dependencies:
  flutter:
    sdk: flutter
  animated_text_kit: ^4.1.1
  cupertino_icons: ^1.0.2

dev_dependencies:
  flutter_test:
    sdk: flutter
flutter:

  uses-material-design: true
  assets:
    - assets/
    - safar.png
    - Geoshare.png
    - sahulat.png
    - swish.png

  fonts:
    - family: Mont
      fonts:
        - asset: assets/MontserratAlternates-Light.ttf
          weight: 300
    - family: Agustina
      fonts:
        - asset: assets/Agustina.ttf

Flutter Doctor

Flutter (Channel stable, 2.2.0, on Microsoft Windows [Version 10.0.19042.985], locale en-US)
    • Flutter version 2.2.0 at C:\src\flutter
    • Framework revision b22742018b (13 days ago), 2021-05-14 19:12:57 -0700
    • Engine revision a9d88a4d18
    • Dart version 2.13.0

[√] Android toolchain - develop for Android devices (Android SDK version 30.0.2)
    • Android SDK at C:\Users\hamas\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.2
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)
    • All Android licenses accepted.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 4.1.0)
    • Android Studio at C:\Program Files\Android\Android Studio
    • Flutter plugin can be installed from:
       https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
       https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b01)

[√] VS Code (version 1.56.2)
    • VS Code at C:\Users\hamas\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.22.0

[√] Connected device (2 available)
    • Chrome (web) • chrome • web-javascript • Google Chrome 
    • Edge (web)   • edge   • web-javascript • Microsoft Edge 
Jessjessa answered 27/5, 2021 at 16:24 Comment(3)
I am having the same issue. Did you have any luck resolving?Suitcase
Well @Suitcase I did try to trying out the paths int the code like assets/images/img.png and for some places I tried assets/ assets/ images /img.png both images are in same path but somehow this works in some places its all hit and trial to work around the issue so its not a correct fix but can be a workaround till I get a correct answerJessjessa
@HAMASURREHMAN i hope you are doing well. i was facing same issue did you found any other solution?Arcade
P
1

maybe try

flutter run --web-renderer html --release 
Phthalocyanine answered 15/11, 2022 at 10:26 Comment(1)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Sideslip

© 2022 - 2024 — McMap. All rights reserved.