How to use different dependency following build environment?

47 views Asked by At

I have the following problem, I'm currently developing 2 apps in Flutter, both depends on a package that I develop too, called shared_libs for the example. Problem here is that when I need to work on a feature that include modification in both the app and the shared_libs packages.

Here what I currently have in my pubspec.yaml:

dependencies:
  shared_libs:
    git:
      url: https://gitlab.com/xxx/shared_libs.git
  # shared_libs:
  #   path: ../shared_libs

So, I need to change the pubspec.yaml file each time before each work session, and change back when I want to commit changes.

I tried looking for a solution for this, but was unable to find anything.

I was naively hoping for something like this

dependencies:
  shared_libs:
    debug:
      path: ../shared_libs
    git:
      url: https://gitlab.com/xxx/shared_libs.git

or

dependencies:
  shared_libs:
    git:
      url: https://gitlab.com/xxx/shared_libs.git
debug_dependencies:
  shared_libs:
    path: ../shared_libs

But it seems I was hoping for nothing. Beside pre/after commit script, I don't have any idea.

Do anyone here have another solution ?

Thanks a lot !

0

There are 0 answers