Global Configuration
Starting from DCM 1.40.0 the version constraint behavior has been changed. For information on previous behavior, see the final section.
DCM supports global configuration, but only for specifying the project-level executable version.
To configure DCM globally, add a dcm_global.yaml file to the root of your project.
Project-level Version Constraint​
The project-level version constraint allows switching between different DCM versions in different projects without manually installing those DCM versions.
For example,
version: '1.36.0'
adding the above file to the root of your project will launch DCM 1.36.0 when the actual installed version is 1.40.0 or higher. Note that the lowest supported version is 1.35.0 and only the exact version is supported.
This configuration will be picked up by the IDE, CLI or CI runs.
While this feature works for both local installations and CI, for CI we would still recommend to install the desired version directly to avoid additional downloads of the DCM executable.
Locating the Installed Executables​
For fresh installations, DCM downloads and caches the specified version under /Users/username/.dcmState/ or /home/username/.dcmState/ or C:\Users\{username}\AppData\Local\.dcmState\ (depending on your platform).
Bypassing the Version Constraint​
To disable launching the configured version for a particular command, pass the --no-global-version CLI flag.
Multi-package Repositories Support​
If you have a monorepo with the dcm_global.yaml file in the root, any command run from a subfolder will still locate that file and launch the configured version.
Keeping the Installed Version Up To Date​
To configure the constraint for the installed DCM version, set it up in your account settings.
If the installed executable does not match the constraint, you'll get a notification in your IDE and all analysis-related DCM commands will produce a warning and exit with an error code.
Previous behavior for DCM 1.39.0 and earlier
DCM supports global configuration, but only for setting the executable version constraint.
To configure DCM globally, add a dcm_global.yaml file to the root of your project:
version: '>=1.17.0 <2.0.0'
The version constraint entry supports the same syntax as the sdk entry (for the Dart SDK version constant) in pubspec.yaml.
If the installed executable does not match the constraint, you'll get a notification in your IDE and all analysis-related DCM commands will produce a warning and exit with an error code.
The tool will continue to work even if the installed DCM version does not match the configured constraint.
For instructions on switching between DCM versions to match your team's constraint, see Managing DCM Versions.
To configure the version constraint for all users, set it up in your account settings.
Multi-package Repositories Support​
If you have a monorepo with the dcm_global.yaml file in the root, DCM will show a version mismatch even if you open just a subpackage.