编辑工具设定

你可以使用任意文本编辑器,结合我们的命令行工具来开发 Flutter 应用。然而,我们推荐使用我们的编辑器插件以获取更好的开发体验。这些插件提供了代码补全、代码高亮、widget 辅助编辑的功能,以及为项目的运行和调试提供支持等。

You can build apps with Flutter using any text editor combined with our command-line tools. However, we recommend using one of our editor plugins for an even better experience. These plugins provide you with code completion, syntax highlighting, widget editing assists, run & debug support, and more.

参考以下步骤为 Android Studio、IntelliJ 或者 VS Code 添加编辑器插件。如果你想使用其他的编辑器,请直接打开 下一节: 开发体验初探,来查看使用其他文本编辑器配合命令行工具来创建和运行 Flutter 应用。

Follow the steps below to add an editor plugin for Android Studio, IntelliJ, or VS Code. If you want to use a different editor, that’s OK, skip ahead to the next step: Test drive.

安装 Android Studio

Install Android Studio

Android Studio 为 Flutter 提供了一个完整的集成开发环境。

Android Studio offers a complete, integrated IDE experience for Flutter.

同时, 你也可以使用 IntelliJ:

Alternatively, you can also use IntelliJ:

安装 Flutter 和 Dart 插件

Install the Flutter and Dart plugins

安装过程如下:

To install these:

  1. 打开 Android Studio。

    Start Android Studio.

  2. 打开插件设置(macOS 系统打开 Preferences > Plugins, Windows 和 Linux 系统打开 File > Settings > Plugins)。

    Open plugin preferences (Preferences > Plugins on macOS, File > Settings > Plugins on Windows & Linux).

  3. 选择 Browse repositories,然后选择 Flutter 插件并点击 安装

    Select Browse repositories, select the Flutter plugin and click Install.

  4. 当弹出安装 Dart 插件提示时,点击 Yes

    Click Yes when prompted to install the Dart plugin.

  5. 当弹出重新启动提示时,点击 Restart

    Click Restart when prompted.

安装 VS Code

Install VS Code

VS Code 是一个可以运行和调试 Flutter 的轻量级编辑器。

VS Code is a light-weight editor with Flutter app execution and debug support.

安装 Flutter 和 Dart 插件

Install the Flutter and Dart plugins

  1. 打开 VS Code。

    Start VS Code.

  2. 打开 查看 > 命令面板…

    Invoke View > Command Palette….

  3. 输入 “install”,然后选择 扩展: 安装扩展

    Type “install”, and select Extensions: Install Extensions.

  4. 在扩展搜索输入框中输入 “flutter”,然后在列表中选择 Flutter 并单击 安装。此过程中会自动安装必需的 Dart 插件。

    Type “flutter” in the extensions search field, select Flutter in the list, and click Install. This also installs the required Dart plugin.

  5. 点击 重新加载 以重新启动 VS Code。

    Click Reload to Activate to reload VS Code.

通过 Flutter Doctor 命令验证是否安装成功

Validate your setup with the Flutter Doctor

  1. 打开 查看 > 命令面板…

    Invoke View > Command Palette….

  2. 输入 “doctor”,选择 Flutter: Run Flutter Doctor

    Type “doctor”, and select the Flutter: Run Flutter Doctor.

  3. 打开 输出 面板查看是否有错误。

    Review the output in the OUTPUT pane for any issues.

下一节

Next step

开发体验初探:创建第一个项目,运行并体验“热重载”。

Take Flutter for a test drive: create a first project, run it, and experience “hot reload”.