@@ -418,14 +418,13 @@ are ignored by all users of your package.
418
418
419
419
# # Best practices
420
420
421
- It's important to actively manage your dependencies and
422
- ensure that your packages use the freshest versions possible.
423
- If any dependency is stale,
424
- then you might have not only a stale version of that package,
425
- but also stale versions of other packages in your dependency graph that
426
- depend on that package.
427
- These stale versions can have a negative impact on
428
- the stability, performance, and quality of apps.
421
+ Be proactive in managing your dependencies.
422
+ Ensure that your packages depend on the freshest versions of packages
423
+ when possible.
424
+ If your package depends on a stale package,
425
+ that stale package may depend on other stale packages in its dependency tree.
426
+ Stale versions of packages can have a negative impact on
427
+ the stability, performance, and quality of your app.
429
428
430
429
We recommend the following best practices for package dependencies.
431
430
@@ -444,6 +443,28 @@ To identify dependencies in your app or package that
444
443
aren't on the latest stable versions,
445
444
use [`dart pub outdated`][].
446
445
446
+ # ## Tighten version constraints for dev dependencies
447
+
448
+ A dev dependency defines a package that you need only when developing.
449
+ A finished app won't need these packages.
450
+ Examples of these packages include tests or code generation tooling.
451
+ Set the version constraints of packages in [`dev_dependencies`][dev-dep]
452
+ to have a lower bound of the latest version on which your package depends.
453
+
454
+ Tightening the version constraints of your dev dependencies might
455
+ resemble the following :
456
+
457
+ ` ` ` yaml
458
+ dev_dependencies:
459
+ build_runner: ^2.4.8
460
+ lints: ^2.1.1
461
+ test: ^1.25.1
462
+ ` ` `
463
+
464
+ This YAML sets the `dev_dependencies` to the latest patch versions.
465
+
466
+ [dev-dep] : /tools/pub/dependencies#dev-dependencies
467
+
447
468
# ## Test whenever you update package dependencies
448
469
449
470
If you run [`dart pub upgrade`][] without updating your pubspec,
0 commit comments