dependency_overrides for dependency with path dependency

Viewed 907

In Flame we have a monorepo with Flame and its bridge packages and all of the bridge packages has Flame as a path dependency (not when they are released). It doesn't seem to be possible to depend on our main branch and on a bridge library on the main branch at the same time, I have this in the pubspec.yaml file:

dependencies:
  flutter:
    sdk: flutter
  flame:
    git:
      url: git@github.com:flame-engine/flame.git
      path: packages/flame
      ref: main
  flame_fire_atlas:
    git:
      url: git@github.com:flame-engine/flame.git
      path: packages/flame_fire_atlas
      ref: main

dependency_overrides:
  flame:
    git:
      url: git@github.com:flame-engine/flame.git
      path: packages/flame
      ref: main

When doing pub get I get:

Error on line 15, column 11: Invalid description in the "flame_fire_atlas" pubspec on the "flame" dependency: "../flame" is a relative path, but this isn't a local pubspec.
   ╷
15 │     path: ../flame
   │           ^^^^^^^^
   ╵
pub get failed (65;    ╵)

which indicates that the dependency_override wasn't used, is it not possible to override path dependencies?

1 Answers

Apparently this is a bug in pub, the only way to solve it for now is to clone the dependencies that you need to the path that the packages expect them.

So in this case I would have to clone the branch of flame that I want to use to ../flame, in relation to the projects pubspec file.

Related