VeryGoodOpenSource / flutter_web_preloader

A brick that creates a smart web entrypoint for Flutter and preloads any type of asset before starting an app.
https://brickhub.dev/bricks/flutter_web_preloader/0.2.0
MIT License
77 stars 7 forks source link

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

Open Nana-Kwame-bot opened 11 months ago

Nana-Kwame-bot commented 11 months ago

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

alestiago commented 11 months ago

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

Flutter doctor ```txt [✓] 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 ```
tomarra commented 10 months ago

@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.

erickzanardo commented 10 months ago

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.

tomarra commented 10 months ago

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?