jonataslaw / getx

Open screens/snackbars/dialogs/bottomSheets without context, manage states and inject dependencies easily with Get.
MIT License
10.29k stars 1.61k forks source link

Flutter web not working at all #3086

Open fisforfaheem opened 5 months ago

fisforfaheem commented 5 months ago

Launching lib\main.dart on Edge in debug mode... Warning: In index.html:37: Local variable for "serviceWorkerVersion" is deprecated. Use "{{flutter_service_worker_version}}" template token instead. Warning: In index.html:46: "FlutterLoader.loadEntrypoint" is deprecated. Use "FlutterLoader.load" instead. ../../../AppData/Local/Pub/Cache/hosted/pub.dev/get-5.0.0-release-candidate-5/lib/get_navigation/src/routes/get_transition_mixin.dart:374:39: Error: Member not found: 'CupertinoRouteTransitionMixin.isPopGestureInProgress'. CupertinoRouteTransitionMixin.isPopGestureInProgress(route); ^^^^^^^^^^^^^^^^^^^^^^ Failed to compile application.

Exited (1).

fisforfaheem commented 5 months ago

flutter 3.22

nekomaruh commented 4 months ago

Happens the same to me with auto_route dependency in flutter 3.22: https://pub.dev/packages/auto_route

Update 16/05/24: Apparently it is not a problem with the package, it is a problem with the latest version of Flutter, in my case it now always appears

Update 17/05/24: I figured it out a solution for this warning. The problem seems to be with index.html in flutter web due to deprecated packages in Flutter 3.22:

  1. Inside <head> tag Replace:
<script>
    // The value below is injected by flutter build, do not touch.
    const serviceWorkerVersion = null;
</script>

By:

<script>
    // The value below is injected by flutter build, do not touch.
    const flutter_service_worker_version = null;
</script>
  1. And if you are using WebView embedding:

Inside <body> tag replace:

 <script>
    window.addEventListener('load', function(ev) {
      // Download main.dart.js
      _flutter.loader.loadEntrypoint({
        serviceWorker: {
          serviceWorkerVersion: serviceWorkerVersion,
        },
        onEntrypointLoaded: function(engineInitializer) {
          engineInitializer.initializeEngine().then(function(appRunner) {
            appRunner.runApp();
          });
        }
      });
    });
  </script>

By:

<script>
    window.addEventListener('load', function(ev) {
      // Download main.dart.js
      _flutter.loader.load({
        serviceWorker: {
          serviceWorkerVersion: serviceWorkerVersion,
        },
        onEntrypointLoaded: function(engineInitializer) {
          engineInitializer.initializeEngine().then(function(appRunner) {
            appRunner.runApp();
          });
        }
      });
    });
  </script>

Hope it helps :)

aniketkhote9 commented 4 months ago

https://github.com/jonataslaw/getx/pull/3095

corepuncher commented 4 months ago

My web build is busted. First I tried to address the flutter_service_worker_version error, and now when I build, in my index.html I have double quotes around the version value like this:

  <script>
    // The value below is injected by flutter build, do not touch.
    var serviceWorkerVersion = ""1234567899"";
  </script>

So then I manually delete the double quotes, and I still have the following errors:

flutter.js:3 Uncaught (in promise) FlutterLoader.load requires _flutter.buildConfig to be set

  <script>
    window.addEventListener('load', function (ev) {
      // Download main.dart.js
      _flutter.loader.load({
        serviceWorker: {
          serviceWorkerVersion: serviceWorkerVersion,
        },
        onEntrypointLoaded: function (engineInitializer) {
          engineInitializer.initializeEngine().then(function (appRunner) {
            appRunner.runApp();
          });
        }
      });
    });
  </script>

So it's like whack-a-mole at this point.

Any ideas what the root cause of this is? I used to be able to build web app fine, until upgrades.

novaldebbyp commented 4 months ago

Try to changed the index.html from this discussion https://stackoverflow.com/questions/78152396/how-do-i-replace-serviceworkerversion-with-flutter-service-worker-version

corepuncher commented 4 months ago

Try to changed the index.html from this discussion https://stackoverflow.com/questions/78152396/how-do-i-replace-serviceworkerversion-with-flutter-service-worker-version

I had it like that basically (except had double quotes, tried changing to single...no difference).

A huge rabbit hole since trying to fix the serviceworker deprecation. I eventually reverted back to an old copy of index.html, and it works. So I will leave for now.

I wonder if I need to rebuild the web files , perhaps my files in that dir are too old (too many flutter versions ago)? And perhaps they changes several things by now.

leferrad commented 4 months ago

Inside \<head> tag Replace:

@nekomaruh I tried your solution but I get this error ReferenceError: serviceWorkerVersion is not defined which makes sense given that variable is not defined.

corepuncher commented 4 months ago

Inside tag Replace:

@nekomaruh I tried your solution but I get this error ReferenceError: serviceWorkerVersion is not defined which makes sense given that variable is not defined.

For me the solution was to delete the contents of /web dir (backing up any mods to index.html) and then remake using:

flutter create --platforms web .

It was much easier than trying to fix all the changes that have occurred since I last made my project.

rafaelbenedetti1 commented 4 months ago

I'm having a problem after update my flutter version to 3.22, I modify the index.html to new mode of app initialization. My application have some textfields, and after upgrade the number keyboard doesn't work, because the six and four keys moves the cursor to right and left and not show the number on field, how can i resolve this?

ChAhmed1 commented 4 months ago

not issue resoolve

fisforfaheem commented 4 months ago

Update your getX to v6 candidate

dineshnagarajandev commented 4 months ago

running flutter pub upgrade --major-versions helps to resolve.

lualbertovargas commented 3 months ago

Me funcionó colocar lo siguiente en el body

<script src="flutter_bootstrap.js" async></script>

y

const serviceWorkerVersion = "{{flutter_service_worker_version}}";

Martin-QPT commented 3 months ago

Deleting the web folder (save off any changes) and then taking a Nuke and Pave approach seems to be the way to do it:

  1. Delete the web folder (save any custom stuff)
  2. run "flutter create --platforms web ."
  3. Test, Test, test your app....
idealprogram commented 1 month ago

Me funcionó colocar lo siguiente en el body

<script src="flutter_bootstrap.js" async></script>

y

const serviceWorkerVersion = "{{flutter_service_worker_version}}";

is work form me thanks, in doc have same things