Flutter web release mode errors

Viewed 1067

I have a flutter app that is running normally on flutter web in debug mode, then I run the same app in release and profile mode with this command flutter run -d chrome --release and it gives a white screen, I opened the chrome console and it gives this error which is ambiguous and can't understand it:

zone.dart:1339 Uncaught FormatException: SyntaxError: Unexpected token < in JSON at position 0
    at Object.c (http://localhost:6282/main.dart.js:4084:3)
    at Object.bjN (http://localhost:6282/main.dart.js:6909:9)
    at WI.tW (http://localhost:6282/main.dart.js:49640:28)
    at WI.J (http://localhost:6282/main.dart.js:49642:29)
    at http://localhost:6282/main.dart.js:125497:12
    at bd3.a (http://localhost:6282/main.dart.js:5826:71)
    at bd3.$2 (http://localhost:6282/main.dart.js:46749:23)
    at bbV.$1 (http://localhost:6282/main.dart.js:46741:30)
    at a8F.rs (http://localhost:6282/main.dart.js:48088:42)
    at aWK.$0 (http://localhost:6282/main.dart.js:47231:11)

Edit 1: The flutter doctor verbose log is:

[√] Flutter (Channel stable, 2.2.3, on Microsoft Windows [Version 10.0.19042.1055], locale en-US)
    • Flutter version 2.2.3 at C:\flutter
    • Framework revision f4abaa0735 (10 days ago), 2021-07-01 12:46:11 -0700
    • Engine revision 241c87ad80
    • Dart version 2.13.4

[!] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    • Android SDK at C:\Users\ASUS\AppData\Local\Android\sdk
    • Platform android-30, build-tools 30.0.3
    • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java
    • Java version OpenJDK Runtime Environment (build 11.0.8+10-b944.6842174)
    X Android license status unknown.
      Run `flutter doctor --android-licenses` to accept the SDK licenses.
      See https://flutter.dev/docs/get-started/install/windows#android-setup for more details.

[√] Chrome - develop for the web
    • Chrome at C:\Program Files (x86)\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 11.0.8+10-b944.6842174)

[√] VS Code (version 1.55.2)
    • VS Code at C:\Users\ASUS\AppData\Local\Programs\Microsoft VS Code
    • Flutter extension version 3.21.0

[√] Connected device (3 available)
    • Redmi Note 8 Pro (mobile) • pns4zlqkivhu9psk • android-arm64  • Android 10 (API 29)
    • Chrome (web)              • chrome           • web-javascript • Google Chrome 91.0.4472.124
    • Edge (web)                • edge             • web-javascript • Microsoft Edge 86.0.622.38

! Doctor found issues in 1 category.

Edit2: The flutter app in debug mode gives those errors in chrome console but it works normally:

GET https://apidev2.koutbo6.com/2.0/online_status/room/1-02162-0/ 401

GET https://dev.koutbo6.com/site_media/avatars/table_image/default/koutbo4.png 404

but, It's related to images I don't think it's the cause of problem.

1 Answers

After very long research I have found that the problem is related to an external package called time_machine and it cause this problem is the init step of it in the web platform only.

Related