Python can have virtual environments, is there an equivalent for Dart/flutter?

596

Solution 1

you can use tow method

  • install different flutter version in multiple path enter image description here

If you're using VSCode, you can download multiple version of flutter SDK into different path and quickly switch between them using Dart&Flutter Plugin

as followin You need to have two flutter SDK folders. One of them you need to rename it to flutter_beta (or whatever you like, I called it that way because on that one I am always on beta channel and in the original one I am always on stable channel). Then, inside that flutter_beta folder you need to go to bin folder and rename the flutter file to flutterbeta (or whatever you want) Then you need to export the path of that new executable like you did to the first one https://flutter.dev/docs/get-started/install/linux#update-your-path And that's all, the VSCode settings.json configuration is optional... reference1


or

  • FVM(flutter version management) enter image description here

In case you have projects in different Flutter SDK versions and do not want to upgrade.

https://github.com/leoafarias/fvm

https://www.youtube.com/watch?v=R6vKde1vIGQ

dart pub global activate fvm
fvm

and chose the version you will use its sdk

notes:You must add the path to the fvm executable to the $PATH environment variable. After running "pub global activate fvm" reference

Solution 2

This package can help you to have multiple Flutter environments on one machine and change them depending on the project you're working on (Like python virtual environments).

https://github.com/lukeurban/flenv

Share:
596
Timothy Lombard
Author by

Timothy Lombard

Python and Programming newbie

Updated on December 27, 2022

Comments

  • Timothy Lombard
    Timothy Lombard over 1 year

    I’m working on several little projects and some of them require different versions of packages and versions of dart flutter. Create virtual environment similar to python?