# Flutter 崩溃报告

> 了解 Google 如何使用崩溃报告、它收集了什么、以及如何禁用它。



If you have not opted-out of Flutter's analytics and crash reporting,
when a `flutter` command crashes,
it attempts to send a crash report to Google in order to
help Google contribute improvements to Flutter over time.
A crash report might contain the following information:

如果你未禁用 Flutter 的分析和崩溃报告，当一条 `flutter` 命令崩溃时，
分析工具会尝试向 Google 发送一份崩溃报告，用于帮助 Google 逐步改进 Flutter。
一份崩溃报告可能包含以下信息：

* The name and version of your local operating system.

  你本地操作系统的名称和版本。
    
* The version of Flutter used to run the command.

  运行命令时所用的 Flutter 版本。
    
* The runtime type of the error, for example
  `StateError` or `NoSuchMethodError`.
  
  错误的运行时类型，
  例如：`StateError` 或者 `NoSuchMethodError`。
    
* The stack trace generated by the crash, which contains references to
  the Flutter CLI's own code and contains no references to
  your application code.
  
  崩溃生成的堆栈跟踪信息，
  包含了对 Flutter CLI 代码的引用，
  但是不包含对你应用本身代码的引用。
  
* A client ID: a constant and unique number generated for
  the computer where Flutter is installed.
  It helps us deduplicate multiple identical crash
  reports coming from the same computer.
  It also helps us verify if a fix works as intended after
  you upgrade to the next version of Flutter.
  
  客户端 ID：为安装了 Flutter 的计算机而生成的一串恒定且唯一的数字。
  它将帮助我们删除同一台计算机的重复崩溃报告。
  还可以帮助我们验证在升级了下一个 Flutter 版本后，解决方案是否按预期工作。

Google handles all data reported by this tool in accordance with the
[Google Privacy Policy][].

Google 会根据 [Google 隐私政策][Google Privacy Policy]
处理此工具报告的所有数据。

You may review the recently reported data in the
`.dart-tool/dart-flutter-telemetry.log` file.
On macOS or Linux, this log is located in the home directory (`~/`).
On Windows, this log is located in the Roaming AppData directory (`%APPDATA%`).

你可以查看 `.dart-tool/dart-flutter-telemetry.log`
文件来回顾近期报告的数据日志。
在 macOS 或 Linux 上，日志文件保存在用户文件夹 (`~/`) 中。
在 Windows 上，日志文件保存在 Roaming AppData 文件夹 (`%APPDATA%`) 中。

## Disabling analytics reporting

## 禁用分析报告

To opt out of anonymous crash reporting and feature
usage statistics, run the following command:

你可以通过运行以下命令，禁用 Flutter 提供的匿名崩溃报告和功能使用统计：

```console
$ flutter --disable-analytics
```

If you opt out of analytics, Flutter sends an opt-out event.
This Flutter installation neither sends nor stores any further information.

如果你选择禁用分析工具，分析工具会发送一个禁用事件，在此之后 Flutter 将不会上报更多信息。

To opt into analytics, run the following command:

```console
$ flutter --enable-analytics
```

To display the current setting, run the following command:

你可以运行以下命令来显示当前设置：

```console
$ flutter config
```

[Google Privacy Policy]: https://policies.google.com/privacy

