Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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?

like image 265
Timothy Lombard Avatar asked Jan 14 '21 01:01

Timothy Lombard


2 Answers

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

like image 150
Youssri Abo Elseod Avatar answered Oct 12 '22 13:10

Youssri Abo Elseod


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

like image 1
Shriyash Warghade Avatar answered Oct 12 '22 15:10

Shriyash Warghade