website icon indicating copy to clipboard operation
website copied to clipboard

Document how to use git submodules to pin Flutter dependency

Open zoechi opened this issue 6 years ago • 2 comments

@eseidelGoogle commented on Fri May 06 2016

I've seen some developers use git submodules. Is that a recommended approach?

Once I write my large app, I want to control when the version of flutter changes, and I want it to be the same between all of my developers.


@sethladd commented on Wed Jul 20 2016

Would https://github.com/dart-lang/pub/issues/1432 be sufficient?


@eseidelGoogle commented on Wed Jul 20 2016

I think this ends up being more than just an sdk fix, since if I have two separate flutter projects, we need a clear story as how I configure Atom differently when working with them, or the flutter command line, etc. Certainly pub support may be part of this, but we also just need a recommended story for Flutter too since so many of our tools are tied into the flutter version.


@sethladd commented on Wed Jul 20 2016

Yes, I'd love per-project SDK configurations in Atom. That would help a lot.


@Hixie commented on Sun Jan 29 2017

This seems to be a dupe of https://github.com/flutter/flutter/issues/3696, so I'm closing it as such. Please reopen if I misunderstood.


@eseidelGoogle commented on Tue Jan 31 2017

This is not the same issue. This is the how-do-i-pin-the-version-of-flutter-my-app-depends-on question. :) i.e. so that all of my 10 developers can get the same version of flutter instead of each of them having different flutter sdk versions depending when they last ran flutter upgrade.


@Hixie commented on Tue Jan 31 2017

Ah, I see. This is basically about giving the flutter tool a way to read your pubspec.yaml and follow the same semantics as we want pub get to use to determine what version of a package to bring in given a particular environment line. Almost the opposite of #3696 in fact.


@eseidelGoogle commented on Tue Jan 31 2017

I have no opinions as to the implementation details. The user journey is that I have a team of N devs, I want them to all be able to build my app using the same version of flutter. Flutter currently has no official releases. What is the best way for my N devs to make sure we're all working from the same copy of the Flutter sdk. The first of our early access partners are already going to start hitting this since multiple of them have multi-person teams (I haven't yet had any complaints however).


@Hixie commented on Tue Jan 31 2017

As of today, one way to do it is to pick a flutter repo git hash, and have everyone check that out instead of top of tree.


@passsy commented on Mon Oct 30 2017

Just faced this error. We want to make sure CI and all devs use the same flutter version. I tried adding flutter as submodule but faced this error message:

Error: The Flutter directory is not a clone of the GitHub project.


@Hixie commented on Thu Nov 02 2017

Weird, do submodules not include .git directories?


@passsy commented on Thu Nov 02 2017

They use the parents .git directory and place content in .git/modules/<submoduleName>/


@amirh commented on Tue Nov 07 2017

+1 to make the flutter tool follow the same semantics of pub get for versioning.

I just bumped into this issue on a personal pet project -

  1. Flutter tool nudged me to flutter upgrade.
  2. I upgraded and pub failed to solve dependency constraints.

After digging into it I found out that the new flutter version had a new dependency on shelf (https://github.com/flutter/flutter/commit/441b5c2031733d0505b8dafdda54cd1ba9887617), which conflicted with my project's dependencies on the built_value toolchain (that required an earlier version of shelf). My only way out was to change my built_value dependencies to latest (build, build_runner, built_value_generator), which included a breaking API change, so I had to figure out the new API and update my code.


@Hixie commented on Thu Nov 09 2017

Ah, right, I was thinking of .svn directories, which are per-folder.

We should just update the flutter tool to correctly handle submodules.


@paulcbetts commented on Thu Jan 18 2018

Hey all, with the fix I just PRed, you should be able to now do:

git submodule add https://github.com/flutter/flutter ./vendor/flutter

Then check in a wrapper flutterw for your vendored Flutter into your project, a-la gradlew:

#!/bin/bash
set -euo pipefail

DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"

export PATH="$DIR/vendor/flutter/bin:$PATH"
exec flutter $@

So instead of flutter doctor, run ./flutterw doctor, and you should have reliable builds, albeit slow in CI environments because flutter will have to redownload Dart et al every time.


@Hixie commented on Thu Jan 18 2018

@sethladd could you add something about this to the faq?


@sethladd commented on Thu Jan 18 2018

https://github.com/flutter/website/blob/master/faq.md will gladly accept PRs :)

In the meantime, we should reopen this or open a new issue for the FAQ entry so it doesn't get lost

zoechi avatar Dec 03 '18 18:12 zoechi

The easiest way for me is to use a helper script. https://github.com/passsy/flutter_wrapper

Could be generated by the flutter cli.

passsy avatar Dec 03 '18 19:12 passsy

@sfshaza2 @zoechi @sethladd @eseidelGoogle Please look into giving an update, this is still an issue, and specifying version doesn't actually even work properly - specifying env variable "2.8.1" would still allow 2.8.2. to build it successfully, only it dissallows 2.8.0. see: https://github.com/flutter/flutter/issues/95472

neiljaywarner avatar Apr 11 '22 16:04 neiljaywarner

This issue is more than 7 years old. If this issue has not been resolved, please file a new issue with details consistent with the current docs site. Thanks!

Closing this issue.

atsansone avatar Jun 01 '23 23:06 atsansone