flutter_web_preloader icon indicating copy to clipboard operation
flutter_web_preloader copied to clipboard

fix: Flutter web does not launch if no assets are found in pubspec.yaml

Open Nana-Kwame-bot opened this issue 2 years ago • 4 comments

Description If you fail to or incorrectly provide assets configuration in pubspec.yaml file the app never finishes launching.

Steps To Reproduce

Just like with #11

  1. Create a flutter app with web platform inclusive
  2. Run mason make flutter_web_preloader and just hit enter so it overrides the index.html
  3. Build and run the app targeting web
  4. See that you get stuck on Launching lib/main_development.dart on Chrome in debug mode... for example and that the progress indicator never fills up.
  5. Adding assets fixes the issue if configured properly, you can just comment it out to replicate the issue or add assets without a tab in-front in the pubspec.

Expected Behavior Launch the app regardless of the asset configuration

Screenshots How it is with/without assets in the pubspec

Nana-Kwame-bot avatar Dec 17 '23 19:12 Nana-Kwame-bot

Thanks @Nana-Kwame-bot for opening this issue! I was able to reproduce it using flutter_web_preloader 0.2.0.

Flutter doctor
[✓] Flutter (Channel stable, 3.16.3, on macOS 14.0 23A344 darwin-arm64, locale
    en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] IntelliJ IDEA Ultimate Edition (version 2023.1.4)
[✓] IntelliJ IDEA Community Edition (version 2023.1.4)
[✓] VS Code (version 1.84.0)
[✓] Connected device (2 available)
[✓] Network resources

alestiago avatar Dec 18 '23 11:12 alestiago

@erickzanardo looking for some input on this one from your side. Overall I think that this is actually not the intended purpose of this package but we could put some kind of workaround in as a just in case type of fix.

tomarra avatar Jan 08 '24 15:01 tomarra

Hey @tomarra :wave:

Think about it right now, I think it can make sense to run this in a project, even if there are no assets listed in the pubspec, since this brick also preloads some internal flutter assets.

erickzanardo avatar Jan 08 '24 17:01 erickzanardo

Think about it right now, I think it can make sense to run this in a project, even if there are no assets listed in the pubspec, since this brick also preloads some internal flutter assets.

Good to know. In that case, is the fix here something you can help document and maybe then someone else can help with the implementation?

tomarra avatar Jan 08 '24 19:01 tomarra