fvm 1.0.4

  • Readme
  • Changelog
  • Example
  • Installing
  • 72

fvm #

Pub Version Maintenance Health Coverage Github All Contributors MIT Licence Awesome Flutter

Flutter Version Management: A simple cli to manage Flutter SDK versions.

FVM helps with the need for a consistent app builds by allowing to reference Flutter SDK version used on a per-project basis. It also allows you to have multiple Flutter versions installed to quickly validate and test upcoming Flutter releases with your apps, without waiting for Flutter installation every time.

Features:

  • Configure and use Flutter SDK version per project
  • Ability to install and cache multiple Flutter SDK Versions
  • Fast switch between Flutter channels & versions
  • Dynamic SDK paths for IDE debugging support.
  • Version FVM config with a project for consistency across teams and CI environments.
  • Set global Flutter version across projects

Version Management #

This tool allows you to manage multiple channels and releases, and caches these versions locally, so you don't have to wait for a full setup every time you want to switch versions.

Also, it allows you to grab versions by a specific release, i.e. v1.2.0 or 1.17.0-dev.3.1. In case you have projects in different Flutter SDK versions and do not want to upgrade.

Usage #

To Install:

> pub global activate fvm

Read dart.dev docs for more info on how to run global dart scripts.

And then, for information on each command:

> fvm help

Install a SDK Version #

FVM gives you the ability to install many Flutter releases or channels.

  • version - use stable to install the Stable channel and v1.8.0 or 1.17.0-dev.3.1 to install the release.
  • --skip-setup - will skip Flutter setup after install
> fvm install <version>

Project Config SDK Version

If you configured your project to use a specific version, run install without any arguments will install the proper version.

> fvm install

Check out use command to see how to configure a version per project.

Use a SDK Version #

You can use different Flutter SDK versions per project. To do that you have to go into the root of the project and:

> fvm use <version>

If you want to use a specific version by default in your machine, you can specify the flag --global to the use command. A symbolic link to the Flutter version will be created in the fvm home folder, which you could then add to your PATH environment variable as follows: FVM_HOME/default/bin. Use fvm use --help, this will give you the exact path you need to configure.

Remove a SDK Version #

Using the remove command will uninstall the SDK version locally, this will impact any projects that depend on that version of the SDK.

> fvm remove <version>

List Installed Versions #

List all the versions that are installed on your machine. This command will also output where FVM stores the SDK versions.

> fvm list

List Flutter Releases #

Displays all Flutter releases, including the current version for dev, beta and stable channels.

> fvm releases

Change FVM Cache Directory #

There are some configurations that allows for added flexibility on FVM. If no cache-path is set, the default fvm path will be used.

fvm config --cache-path <path-to-use>

List Config Options #

Returns list of all stored options in the config file.

fvm config --ls

Running Flutter SDK #

There are a couple of ways you can interact with the SDK setup in your project.

Proxy Commands

Flutter command within fvm proxies all calls to the CLI just changing the SDK to be the local one.

> fvm flutter run

This will run flutter run command using the local project SDK. If no FVM config is found in the project. FMV will recursively try for a version in a parent directory.

Call Local SDK Directly

FVM creates a symbolic link within your project called fvm which links to the installed version of the SDK.

> .fvm/flutter/bin run

This will run flutter run command using the local project SDK.

As an example calling fvm flutter run is the equivalent of calling flutter run using the local project SDK.

Configure Your IDE #

In some situations you might have to restart your IDE and the Flutter debugger to make sure it uses the new version.

VSCode

Add the following to your settings.json. This will list list all Flutter SDKs installed when using VSCode when using Flutter: Change SDK.

Use fvm list to show you the path to the versions.

List all versions installd by FVM
{
  "dart.flutterSdkPaths": ["/Users/usr/fvm/versions"]
}
{
  "dart.flutterSdkPaths": [".fvm/flutter_sdk"]
}

Android Studio

Copy the absolute path of fvm symbolic link in your root project directory. Example: /absolute/path-to-your-project/.fvm/flutter_sdk

In the Android Studio menu open Languages & Frameworks -> Flutter or search for Flutter and change Flutter SDK path. Apply the changes. You now can Run and Debug with the selected versions of Flutter.

Add your IDE instructions here

Working with this repo #

Tests #

pub run test

Publishing package #

Before pushing package to pub.dev. Run command to create version constant.

pub run build_runner build

Update test coverage #

To update test coverage run the following command.

pub run test_coverage

License #

This project is licensed under the MIT License - see the LICENSE file for details

Contributors ✨ #

Thanks goes to these wonderful people (emoji key):


Leo Farias

📖 🤔 💻 💡 👀 🚧 🚇

Ianko Leite

🤔

Caijinglong

💻 🤔

zmtzawqlp

🐛

Peter Leibiger

💻 🚧

David Martos

💻 ⚠️ 📖

Luca Panteghini

📖

This project follows the all-contributors specification. Contributions of any kind welcome!

Changelog #

1.0.4 #

  • Indicates global version on list command.

1.0.3 #

  • Fixes issue with stdin on Flutter commands.

1.0.2 #

  • Indicates channels on fvm releases command.

1.0.1 #

  • Suppress verbose message for install progress.

1.0.0 #

  • List Flutter Releases
  • Bug fixes and optimization
  • Project refactoring

0.8.3 #

  • Installation progress output
  • Flutter setup on installation
  • Ability to skip setup with--skip-setup

0.8.2 #

  • Size optimization of SDK downloads
  • Code clean-up

0.8.1 #

  • Fixes list command when project has no config.

0.8.0 #

  • Implemented --global flag to set a specific version globally.
  • Changed project configuration to allow for versioning.
  • Refactoring and project clean-up
  • Better user experience
  • Improved error messages

0.7.2 #

  • Better compatibility with flutter commands.

0.7.1 #

  • Updated version constant

0.7.0 #

  • Added support for new Flutter 1.17.0+ versioning scheme - The new versioning scheme includes changes to tag names and thus also version names for FVM. When reinstalling Flutter versions <1.17.0, the FVM install-path will change, potentially breaking projects that rely on the install-path. The install-path will change from ~/fvm/versions/1.15.17 to ~/fvm/versions/v1.15.17. Make sure to change this in your IDE configuration.

0.6.7 #

  • Added version command to see currently installed fvm version

0.6.6 #

  • Better Flutter command compatibility
  • Improved error logging and --verbose behavior
  • Friendlier error messages

0.6.5 #

  • Better Error handling and friendlier error message

0.6.4 #

  • Project clean-up and tweaks for better pub analysis.

0.6.3 #

  • Initial stable version rewritten in Dart.

example/README.md

Example #

The following is a step by step if you want to run an specific version of Flutter within a project.

First choose the version you would like to install and cache on your machine.

This will install version 1.17.4 and cache locally.

> fvm install 1.17.4

Go into the project directory

> cd path/to/project

Set the project to use the version that you have installed.

> fvm use 1.17.4

Use this package as an executable

1. Install it

You can install the package from the command line:


$ pub global activate fvm

2. Use it

The package has the following executables:


$ fvm

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  fvm: ^1.0.4

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

Alternatively, your editor might support pub get or flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:fvm/fvm.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
44
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
72
Learn more about scoring.

We analyzed this package on Jul 14, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.15

Analysis suggestions

Package not compatible with runtime flutter-web on Web

Because:

  • package:fvm/fvm.dart that imports:
  • package:io/ansi.dart that imports:
  • package:io/src/ansi_code.dart that imports:
  • dart:io

Package not compatible with runtime js

Because:

  • package:fvm/fvm.dart that imports:
  • package:io/ansi.dart that imports:
  • package:io/src/ansi_code.dart that imports:
  • dart:io

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.5.0 <3.0.0
args ^1.5.3 1.6.0
cli_util ^0.2.0 0.2.0
console ^3.1.0 3.1.0
date_format ^1.0.8 1.0.8
http ^0.12.1 0.12.1
io ^0.3.3 0.3.4
path ^1.6.4 1.7.0
process_run ^0.10.10+1 0.10.10+2
Transitive dependencies
charcode 1.1.3
collection 1.14.13 1.15.0-nullsafety
http_parser 3.1.4
meta 1.2.2 1.3.0-nullsafety
pub_semver 1.4.4
source_span 1.7.0
string_scanner 1.0.5
term_glyph 1.1.0
typed_data 1.2.0 1.3.0-nullsafety
vector_math 2.0.8 2.1.0-nullsafety
yaml 2.2.1
Dev dependencies
build_runner ^1.0.0
build_version ^2.0.1
pedantic ^1.8.0 1.9.2
test ^1.14.0
test_coverage ^0.4.1