leoafarias / fvm

Flutter Version Management: A simple CLI to manage Flutter SDK versions.
https://fvm.app
MIT License
4.73k stars 233 forks source link

[BUG] fvm keeps modifying ~/fvm/versions/stable/packages/flutter/lib/src/services/binding.dart with incorrect syntax #756

Closed cjmeyer-polymorph closed 3 months ago

cjmeyer-polymorph commented 4 months ago

Before creating a bug report please make check the following

Describe the bug I used to have Flutter installed to my system, then using fvm created the issue I will describe below. Then I uninstalled Flutter completely and only used fvm, and it kept doing this even on different repositories:

I would run the project on debugging mode in VS Code (I always run it on a Chrome window and that is the only device I have available on this computer.)

After a few runs it adds a breakpoint in ~/fvm/versions/stable/packages/flutter/lib/src/services/binding.dart due to an error I guess, but you can go past the breakpoint. It seems that it adds a space between 'completer' and '.complete(reply);'

You have to skip past the breakpoint every time you run the project, but then after quite a few runs, it can't run at all, and it seems fvm has inserted garbage text in that line; the latest time it happened it seems to have rendered the line 'completerColu.complete(reply);'

It gets resolved after 'flutter destroy' and 'flutter use stable'. But after a few runs the issue returns.

To Reproduce Steps to reproduce the behavior described above

Expected behavior

Logs

Desktop (please complete the following information):

Additional context FVM Doctor:

Project: ┌─────────────────────────────┬───────────────────────────────────────────────────────────────────────────────────┐ │ Project │ my-project │ ├─────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────┤ │ Directory │ /Users/cjmeyer/Documents/my-project │ ├─────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────┤ │ Active Flavor │ None │ ├─────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────┤ │ Is Flutter Project │ Yes │ ├─────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────┤ │ Dart Tool Generator Version │ 3.4.4 │ ├─────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────┤ │ Dart tool version │ 3.22.3 │ ├─────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────┤ │ .gitignore Present │ Yes │ ├─────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────┤ │ Config Present │ Yes │ ├─────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────┤ │ Pinned Version │ FlutterVersion(name: stable, releaseFromChannel: null, type: VersionType.channel) │ ├─────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────┤ │ Config path │ .fvmrc │ ├─────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────┤ │ Local cache dir │ .fvm/versions │ ├─────────────────────────────┼───────────────────────────────────────────────────────────────────────────────────┤ │ Version symlink │ .fvm/versions/stable │ └─────────────────────────────┴───────────────────────────────────────────────────────────────────────────────────┘

IDEs: ┌────────────────────────────────┬─────────────────────────────────────────────────────┐ │ IDEs │ Value │ ├────────────────────────────────┼─────────────────────────────────────────────────────┤ │ VSCode │ │ ├────────────────────────────────┼─────────────────────────────────────────────────────┤ │ dart.flutterSdkPath │ .fvm/versions/stable │ ├────────────────────────────────┼─────────────────────────────────────────────────────┤ │ Matches pinned version: │ true │ ├────────────────────────────────┼─────────────────────────────────────────────────────┤ │ IntelliJ (Android Studio, ...) │ │ ├────────────────────────────────┼─────────────────────────────────────────────────────┤ │ IntelliJ (Android Studio, ...) │ No local.properties file found in android directory │ ├────────────────────────────────┼─────────────────────────────────────────────────────┤ │ IntelliJ (Android Studio, ...) │ No .idea folder found │ └────────────────────────────────┴─────────────────────────────────────────────────────┘

Environment: ┌────────────────────────┬────────────────────────────────────────────────┐ │ Environment Variables │ Value │ ├────────────────────────┼────────────────────────────────────────────────┤ │ Flutter PATH │ /Users/cjmeyer/fvm/versions/stable/bin/flutter │ ├────────────────────────┼────────────────────────────────────────────────┤ │ Dart PATH │ /usr/local/bin/dart │ ├────────────────────────┼────────────────────────────────────────────────┤ │ FVM_CACHE_PATH │ N/A │ ├────────────────────────┼────────────────────────────────────────────────┤ │ FVM_USE_GIT_CACHE │ N/A │ ├────────────────────────┼────────────────────────────────────────────────┤ │ FVM_GIT_CACHE_PATH │ N/A │ ├────────────────────────┼────────────────────────────────────────────────┤ │ FVM_FLUTTER_URL │ N/A │ ├────────────────────────┼────────────────────────────────────────────────┤ │ FVM_PRIVILEDGED_ACCESS │ N/A │ ├────────────────────────┼────────────────────────────────────────────────┤ │ Flutter PATH │ /Users/cjmeyer/fvm/versions/stable/bin/flutter │ ├────────────────────────┼────────────────────────────────────────────────┤ │ Dart PATH │ /usr/local/bin/dart │ └────────────────────────┴────────────────────────────────────────────────┘ ┌──────────────┬────────────────────────────────────────────────────────────────┐ │ Platform │ Value │ ├──────────────┼────────────────────────────────────────────────────────────────┤ │ OS │ macos Version 14.5 (Build 23F79) │ ├──────────────┼────────────────────────────────────────────────────────────────┤ │ Dart Locale │ en-GB │ ├──────────────┼────────────────────────────────────────────────────────────────┤ │ Dart runtime │ 3.4.1 (stable) (Tue May 21 15:46:25 2024 +0000) on "macos_x64" │ └──────────────┴────────────────────────────────────────────────────────────────┘

leoafarias commented 3 months ago

@cjmeyer-polymorph Hmmm, maybe it is something in the IDE that is modifying the code, as FVM does not do anything like this. Do you have the .fvm ignored in VSCode? That should ensure it avoids the breakpoints, I believe.

cjmeyer-polymorph commented 3 months ago

Thanks, I'm sure it is something in VSCode. Yes, the whole .fvm folder is ignored in launch.json for VSCode. If this is not an identifiable error to you, this must be an issue with my machine only.