JerryZhou
JerryZhou

Reputation: 5166

Flutter Plugins pub conflict when other dependency depends on it and it also still in developing

Because I made some change in Plugins/Path_Provider, and it's still in development.

I know this is an expect result because of version conflict for Path_Provider with two version, one in git and one in pub host.

But still this is a case when development. Is there any best practice for this specific duration case ?

pubspec.yml:

dependencies:
  ...
  localstorage: ^2.0.0
  path_provider: #^1.1.0 
    git:
      url: https://github.com/xxxxxxxx/plugins
      ref: dev/path_provider_add_getApplicationLibraryDirectory
      path: packages/path_provider
      version: ^1.1.0 

Console after flutter packages get:

[MyApp] flutter packages get
Running "flutter pub get" in MyApp...                            
Because localstorage 2.0.0 depends on path_provider ^1.1.0 and
  no versions of localstorage match >2.0.0 <3.0.0, 
  localstorage ^2.0.0 requires path_provider from hosted.

So, because MyApp depends on both path_provider from git and
  localstorage ^2.0.0, version solving failed.

Upvotes: 2

Views: 2247

Answers (1)

G&#252;rkan Sevinc
G&#252;rkan Sevinc

Reputation: 439

You can use dependency_overrides in your pubspec.yml of course just for development. here is the details

pubspec.yml:

dependencies:
  ...
  localstorage: ^2.0.0
  path_provider: ^1.1.0 

dependency_overrides:
  path_provider: 
    git:
      url: https://github.com/xxxxxxxx/plugins
      ref: dev/path_provider_add_getApplicationLibraryDirectory
      path: packages/path_provider
      version: ^1.1.0 

Upvotes: 5

Related Questions