Flutter是一种流行的跨平台移动应用开发框架,它允许开发人员使用相同的代码库创建iOS和安卓应用程序。为了管理Flutter项目的版本,开发人员通常使用版本控制系统,例如Git。可是,fvm是一个新的版本管理器,专门为Flutter项目设计,以简化版本控制和更新过程。
fvm是一个命令行工具,用于管理Flutter项目的版本。与传统的版本控制系统不同,fvm更加简单和直观,因为它专门为Flutter设计。通过fvm,您可以轻松地切换到不同的Flutter版本,测试新的功能和修复程序,并快速恢复到之前的版本。
使用fvm非常简单。您只需要打开终端并运行以下命令:
``` fvm use ``` 其中,``是您要使用的Flutter版本号。比如,如果您要使用Flutter 1.19.14,您可以运行以下命令:
``` fvm use 1.19.14 ``` 一旦您选择了要使用的Flutter版本,fvm将自动更新您的项目以使用该版本。您还可以使用以下命令查看可用的Flutter版本:
``` fvm versions ``` fvm还提供了一些其他有用的命令,例如:
* `fvm clean`:清除缓存和构建输出。 * `fvm install`:安装所需的依赖项。 * `fvm revert`:恢复到先前的Flutter版本。 * `fvm diff`:比较当前Flutter版本与先前版本的相差之处。
fvm是一个非常有用的工具,可以帮助您更轻松地管理Flutter项目的版本。它专门为Flutter设计,使您能够更快地开发和测试新功能,同时防止手动更新和配置的过程。如果您正在使用Flutter开发项目,那么fvm是一个值得尝试的工具。
Added
- Tighter VSCode integration, with configuration and settings management. FVM will now automatically configure VSCode to use the correct Flutter SDK version, triggering a termianl path update, so you can just use flutter, commands instead of fvm flutter
- Git Flutter repository mirroring for faster cloning of new versions.
- Added a check in .gitignore for the '.fvm' directory, and auto-adding it if necessary.
- Added verification if cached Flutter SDK has been upgraded, and provide options for corrective actions.
- Added a check for Flutter SDK constraints check for compatibility with current project.
- Improved FVM configuration management and settings.
- Ability to override FVM settings on a per project basis.
- Windows "unpriviledge" mode. If you you choose to run fvm in unpriviledge mode, it will not require admin rights to run, however local Flutter SDK project references will be absolute paths instead of relative links.
Improvements
- Much improved DX with better error messages and logging, and more helpful information and how to proceed.
- Color output when using fvm flutter command proxy.
- Better SDK switching workflow per project. Handle more edge cases, by doing SDK comparisons.
- Better fvm doctor command. Now provides much better output and information about the project and environment.
- Better Dart SDK environment support, minimizes conflicts between multiple environment Dart SDKs.
- Improved fvm releases output.
- Improved fvm list output.
- Better error checking for fvm global command.
- FVM update check now runs only once a day.
- You can disable update check with the --update-check flag on fvm config
Changed
- Command fvm releases now defaults to stable channel. Use --all flag to see all releases, or filter by channel.
- Removed "flavor" command in favor for fvm use {flavor}
- Removed "destroy" command in favor of fvm remove --all
- Config file is now .fvmrc instead of .fvm/fvm_config.json, and .fvm can be added to .gitignore, FVM will migrate it automatically.
- You can now use fvm use {version} --env {flavor} as an alias for flavor. Might be deprecated in the future since env has become a better description for environment specific settings than flavor.
- When installing or using a Flutter repo commit hash, hash needs ot be 10 digits. FVM will now validate it, and provide the correct hash if it can.
Breaking Changes
- Default FVM config location is now .fvmrc instead of .fvm/fvm_config.json. FVM will migrate it automatically. However .fvm should be ignored, if you depend on fvm_config.json in your tools or CI, you should update your configuration.
- fvm install - Will not setup by default. Use --setup flag to setup Flutter SDK. Flag --skip-setup is removed.
- fvm releases - Defaults to stable releases. Use --all flag to see all releases, or filter by channel using --channel {channel}.
- fvm flavor - Removed in favor of fvm use {flavor}.
- fvm use - Will always setup by default. Use --skip-setup flag to skip setup.
- Environment variables FVM_HOME is now FVM_CACHE_PATH.
- Environment variables FVM_GIT_CACHE is now FVM_FLUTTER_URL.