felangel / bloc

A predictable state management library that helps implement the BLoC design pattern
https://bloclibrary.dev
MIT License
11.77k stars 3.39k forks source link

fix: TypeError: Cannot read properties of undefined after flutter upgrade to flutter 3.25 #4226

Closed nightcap79 closed 1 month ago

nightcap79 commented 1 month ago

Description Unfixable problems when using bloc or hydratedbloc after upgrade flutter to 3.25 the latest stable version

felangel commented 1 month ago

Can you share a minimal reproduction sample?

dherediat97 commented 1 month ago

My Enviroment:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.24.0, on Microsoft Windows [Versi¢n 10.0.22631.3958], locale es-ES)
[√] Windows Version (Installed version of Windows is version 10 or higher)
[√] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[√] Chrome - develop for the web
[X] Visual Studio - develop Windows apps
    X Visual Studio not installed; this is necessary to develop Windows apps.
      Download at https://visualstudio.microsoft.com/downloads/.
      Please install the "Desktop development with C++" workload, including all of its default components
[√] Android Studio (version 2024.1)
[√] VS Code (version 1.92.1)
[√] Connected device (3 available)
[√] Network resources

Normally i run and publish my code into a website(here, with Github Pages) but also in Android App

Description:

The first of all, the version is the 3.24.0, the 3.25.0 yet isn't out.

Then, the first problem that i had after: flutter upgrade

is this: Uncaught Error: Mismatched anonymous define() module: () => CanvasKitInit

the second, is this: Cannot read properties of undefined (reading 'AppRoutePaths')

Remember always cleaning the pub folders when flutter engine upgrade with: flutter clean

and remeber also re run: dart run build_runner build --delete-conflicting-outputs

Downgrade flutter_bloc => 8.1.4, clean and re run the build_runner works :), but in each time that run Flutter, in the run not, i mean, after close all editors and VSCode or Android Studio

If not work, clean again, Flutter changes something in the later version and Flutter Bloc not working

With that also works in web: Related issue

I did this "manual" while i found the errors, Thanks!!!! 👍🏼

If someone of flutter_bloc need debug this error i can put here the full stack_trace....

@nightcap79, @felangel

Cheers!!

hawkewebtpa commented 1 month ago

Seems similar/same to/as? https://github.com/flutter/flutter/issues/153222 ?

Uncaught TypeError: Cannot read properties of undefined (reading 'load') at (index):207:30

Is this related or should I file a separate ticket for this variant?

We've run into similar issue. We recently tried upgrading our project from 3.19.5 to 3.24.0, but unfortunately when trying to implement update to deprecation in index.html for: Warning: In index.html:189: "FlutterLoader.loadEntrypoint" is deprecated. Use "FlutterLoader.load" instead. See https://docs.flutter.dev/platform-integration/web/initialization for more details. by changing: ... _flutter.loader.loadEntrypoint({ ... to ... _flutter.FlutterLoader.load({ ...

Unfortunately causes issue with page just hanging on load, and only thing shown is in browser dev tool console: Uncaught TypeError: Cannot read properties of undefined (reading 'load') at (index):207:30

This goes away if I revert back to _flutter.loader.loadEntrypoint({. Downgrading to 3.22.3 did not help. Suggestions?

felangel commented 1 month ago

It's hard to say without a reproduction sample. If this is still an issue please share a link to a reproduction sample on GitHub along with detailed reproduction steps and I'm happy to take a closer look, thanks!

khamidjon-khamidov commented 4 weeks ago

@felangel I am also facing the issue. It usually happens on hot reload. But hard to say how to reproduce