Automated Fixes

Automated Fixes

Flutter provides a tool to help clean up deprecated APIs from your codebase.

The tool ships as part of Flutter, and suggests changes that you might want to make to your code.

The tool is available from the command line.

(Tip

These automated updates are called quick-fixes in IntelliJ and Android Studio, and code actions in VS Code.)

Applying individual fixes

IntelliJ and Android Studio

When the analyzer detects a deprecated API, a light bulb appears on that line of code. Clicking the light bulb displays the suggested fix that updates that code to the new API. Clicking the suggested fix performs the update.

Screenshot showing suggested change in IntelliJ

VS Code

When the analyzer detects a deprecated API, it presents an error.

Hover over the error and then click the Quick Fix link. This presents a filtered list showing only fixes.

Put the caret in the code with the error and click the light bulb icon that appears. This shows a list of all actions, including refactors.

Screenshot showing suggested change in VS Code