If, for example, you run dpx dependency_validator on Dart 3.4 and then again on Dart 2.19, you'll get this error:
> dpx dependency_validator
dependency_validator as globally activated doesn't support Dart 2.19.6, try: dart pub global activate dependency_validator
This is because dpx finds that dependency_validator is already globally activated and skips the activation step to save time. Note that even if we move forward with #11, this issue would still apply when a version constraint is specified.
To fix this, we could:
Detect this specific error message and re-activate to workaround it.
Detect whether the globally activated package supports the current SDK. Not sure where this information is stored (if at all); need to investigate.
If, for example, you run
dpx dependency_validator
on Dart 3.4 and then again on Dart 2.19, you'll get this error:This is because
dpx
finds thatdependency_validator
is already globally activated and skips the activation step to save time. Note that even if we move forward with #11, this issue would still apply when a version constraint is specified.To fix this, we could: