最白目
最白目

Reputation: 3654

Is there a way to "tie" Flutter version to source control?

I know I can set the constraints in pubspec.yaml to specify which Flutter version has to be used for this particular version of my app, but I wonder if I can just tell the app somehow to just use that version of Flutter, and check that into source control.

Example of my problem: We have one develop branch where we develop new features for the next major release, which also uses e.g. Flutter 1.22, but on a hotfix branch, we still need to fix old bugs from current live version, which still runs on e.g. 1.20.

-> I want the correct Flutter version to automatically be used if I switch between my hotfix and my develop branch. Can this be achieved?

Upvotes: 0

Views: 195

Answers (2)

Randal Schwartz
Randal Schwartz

Reputation: 44220

If you wanna see how Google tracks approved versions of Dart against approved versions of Flutter, go into the Flutter distro and try git log bin/internal/engine.version. That's basically the sha1 in the Dart repo that goes with this version of Flutter.

Upvotes: 0

Antoniossss
Antoniossss

Reputation: 32550

What I would do is that I would create a convention od SDK location, for example, say that all developers has to have flutter SDK installations in

%DEV_LOCAL_DIRECTORY_OF_CHOOSING%/flutter/version_number/

then I would create bat file to execute flutter from the project. For project using flutter lats say 1.1, it will be

%DEV_LOCAL_DIRECTORY_OF_CHOOSING%/flutter/1.1/flutter.bat *%

this bat would go to the source control. Now, path to the proper SDK version will be stored in the VCS and can follow the project as you requested. When you update flutter in the application, you update your bat file as well.

Now whenever you will switch between versions, running flutter from the project directory will use proper version of SDK, or fail and force developer to install such if it is not present on the system.

Upvotes: 1

Related Questions