dart fix

The dart fix command finds and fixes two types of issues:

  • Analysis issues identified by dart analyze that have associated automated fixes (sometimes called quick-fixes or code actions)

    To learn more about customizing the analysis issues identified, see Customizing static analysis.

  • Outdated API usages when updating to newer releases of the Dart and Flutter SDKs.

To preview proposed changes, use the --dry-run flag:

$ dart fix --dry-run

To apply the proposed changes, use the --apply flag:

$ dart fix --apply