5

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?

spydon
  • 9,372
  • 6
  • 33
  • 63
  • Does this answer apply to your case? Please check on your end - https://stackoverflow.com/a/54435980/15117201 – Jahn E. Nov 23 '21 at 10:46
  • We can clone the dependency again of course, but this shouldn't be how `dependency_overrides` work? Do you know if it is documented somewhere, or if there is a bug filed for it? – spydon Nov 23 '21 at 10:49
  • Found the related issue: https://github.com/dart-lang/pub/issues/2447 – spydon Nov 23 '21 at 10:52

2 Answers2

0

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.

spydon
  • 9,372
  • 6
  • 33
  • 63
0

see this this solution it may help you.

  • 1
    As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 18 '23 at 06:26
  • While this link may answer the question, it is better to include the essential parts of the answer here and provide the link for reference. Link-only answers can become invalid if the linked page changes. - [From Review](/review/late-answers/33652246) – V-rund Puro-hit Jan 24 '23 at 10:12