Comments (4)
My understanding of dependency_overrides
is that is should force constraint resolution to use the indicated version (https://dart.dev/tools/pub/dependencies#dependency-overrides), irrespective of the version constraint specified in either your direct dependencies:
section or the version constraint from any direct or transitive dep.
Can you confirm that you are seeing something different from this? Preferably via a minimal repro. Thanks!
from sdk.
@devoncarew Correct, based on the current usage of dependency_overrides
, which affects only the dependencies of your own project.
I am proposing augmenting the pubspec.yaml
syntax to add a new dependency_overrides
section as a child of any dependency, so that the dependencies of the dependency can be forced to a specific version.
The "repro" is the bug report I linked. Basically, tyr depending upon firebase_admin: ^0.2.0
and http: ^1.0.0
in the same project, and you will see the problem. firebase_admin
is compatible with http: ^1.0.0
, but its own dependency on this is http: ^0.13.0
, so you cannot use if your project needs http: ^1.0.0
(possibly because another dependency you are using depends upon it), you can't build your project, even though all the code would compile and work just fine with http: ^1.0.0
.
Therefore, currently the only fix is to fork the firebase_admin
project, change your fork's dependency to http: '>=0.13.0 <2.0.0'
, then change your project to depend upon your fork. This is a pain in the butt, and leads to a lot of different projects having to fork the same project just to get their build dependencies to resolve.
What I am proposing is allowing the user to override the version requirement of any dependency of any dependency of your project. This is not what dependency_overrides
currently does. Look where I wrote dependency_overrides
in the yaml example I gave. Currently you can't use dependency_overrides
there. I am proposing that it should be allowed, for dependency-specific transitive dependency overrides.
from sdk.
@devoncarew Correct, based on the current usage of
dependency_overrides
, which affects only the dependencies of your own project.
To be clear, is does affect the transitive dependencies. dependency_overrides
can be and is used to work around the problem of a dep not updating one of it's own dependencies. dependency_overrides
lets you ignore the version constraints that your pubspec + transitive deps would otherwise impose on that dep.
https://github.com/dart-lang/sdk/wiki/Flutter-Pinned-Packages#i-see-issues-through-one-of-my-dependencies-but-they-cant-immediately-release-a-new-version mentions this as a way to get around periodic issues with flutter pinned packages.
from sdk.
To be clear, is does affect the transitive dependencies.
Ah, OK, thank you for explaining that. I jumped to the conclusion that I couldn't override dependencies in other packages using a directive in my own package. Thanks, I'll close this!
from sdk.
Related Issues (20)
- [Null-aware elements] co19 Tests HOT 5
- [Null-aware elements] All tests in tests/language and co19 passing.
- Feature Request: Push Members Down & Safe Delete Refactor
- Macro: `extendsType` freezes analyzer HOT 5
- Ctrl + Click on @override should take you to the method being overriden HOT 8
- [dart2wasm] Compiler crash when using ffi Structs as a paramter to @Native HOT 3
- [Exhaustiveness Checking] Different behavior between statements and expressions HOT 12
- Language server is failing to initiate after upgrade to Dart 3.4.1 HOT 7
- Dart API docs for analyzer Package are missing HOT 9
- `TargetKind` for resource identifiers annotations HOT 1
- Error.throwWithStackTrace hides type and message of error HOT 3
- [CFE] Add implicit "return null" to AST if function end is reachable according to Dart language flow analysis
- `Swap with parent/child` assist should work on single-child `Flex`
- avoid_init_to_null fix of late initialize causes runtime errors HOT 1
- [dart2wasm] iFrame locks position on transition into view HOT 4
- [CP] [vm/ffi] Fix variadic arguments on MacOS Arm64 HOT 2
- analyzer plugins do not reanalyze non-Dart files when they are modified HOT 7
- `dart fix` output case inconsistency HOT 1
- Import `new_library` assist should auto-remove unecessary import HOT 2
- Add more context to `not_a_type` diagnostics HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdk.