Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add documentation to optionally allow users to forward all flutter, dart calls to fvm #719

Open
humblerookie opened this issue Apr 30, 2024 · 2 comments
Labels
enhancement New feature or request

Comments

@humblerookie
Copy link
Contributor

humblerookie commented Apr 30, 2024

Before creating a feature request make sure the suggestion fit within our principles

Is your feature request related to a problem? Please describe.

Yes, I use a few scripts which rely on using naked flutter calls instead of fvm since they operate on the CI as well. However, this creates an issue when working seamlessly withfvm on my local machine. I'm assuming a lot of folks would end up with such a situation.

Describe the solution you'd like
I feel it might benefit a lot of people if we include a documentation that allowed people to redirect naked flutter/dart calls to fvm. I understand this might create slight friction with fvm principles, however since its documentation and strictly optional, Im assuming it wouldn't be an issue. The documentation can be along the following lines


Reroute flutter & dart commands (Optional)

You can run the commands below so that all calls invoking flutter or dart are automatically redirected to using fvm flutter or fvm dart.

On Mac

  • sudo echo 'fvm flutter ${@:1}' > "/usr/local/bin/flutter" && sudo chmod +x /usr/local/bin/flutter
  • sudo echo 'fvm dart ${@:1}' > "/usr/local/bin/dart" && sudo chmod +x /usr/local/bin/dart

On Linux

  • echo 'fvm flutter ${@:1}' > "$HOME/.local/bin/flutter" && chmod +x "$HOME/.local/bin/flutter"
  • echo 'fvm dart ${@:1}' > "$HOME/.local/bin/dart" && chmod +x "$HOME/.local/bin/dart"

Remove reroutes

On Mac

  • sudo rm /usr/local/bin/flutter
  • sudo rm /usr/local/bin/dart

On Linux

  • rm "$HOME/.local/bin/dart"
  • rm "$HOME/.local/bin/flutter"

Describe alternatives you've considered
I have considered command aliases as an alternate approach which are less intrusive however, they wont work with scripts unless you export the corresponding environment files from within the script.

Additional context
I'm still figuring a way to do an equivalent in windows but I don't own a machine so it would be great if someone else can provide a snippet. There are caveats to this approach as well, mainly if a user already has installed flutter via brew or any other native package managers, the binaries may conflict. I'd assume adding a note around this would inform users about the same.

@humblerookie humblerookie added the enhancement New feature or request label Apr 30, 2024
@leoafarias
Copy link
Owner

@humblerookie This makes sense. Would you like to update the docs website? I can review it. I think we can add this as a tip in this section here:
https://fvm.app/documentation/guides/running-flutter#call-sdk-directly

@humblerookie
Copy link
Contributor Author

@leoafarias Done #735

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants