【Flutter, Dart, freezed】Bad state: Unexpected diagnosticsでbuildが終わらない不具合

# TL;DR
`pubspec.yaml` に以下の2つを追加してください

```pubspec.yaml
dependencies:
  analyzer: ^0.39.14 <- 追加

dev_dependencies:
  build_runner: ^1.10.0 <- 追加
```

## 環境

```sh
# fvmを使用
[✓] Flutter (Channel unknown, 1.20.2, on Mac OS X 10.15.5 19F101, locale ja-JP)
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
[✓] Xcode - develop for iOS and macOS (Xcode 11.6)
[✓] Android Studio (version 4.0)
```

## 症状
- `Bad state: Unexpected diagnostics:` が大量に表示される
- `[INFO] 1.6s elapsed, 1/12 actions completed.` が永遠に完了しない

```sh
$ fvm flutter packages pub run build_runner build --delete-conflicting-outputs

[...]

[INFO] Running build...
[INFO] Generating SDK summary...
[SEVERE] freezed:freezed on test/widget_test.dart:

Bad state: Unexpected diagnostics:
/Users/k3ntar0/fvm/versions/1.20.2/bin/cache/dart-sdk/lib/core/uri.dart:3259:39 - Expected an identifier.
[SEVERE] freezed:freezed on test/widget_test.dart:

[...]

Bad state: Unexpected diagnostics:
/Users/k3ntar0/fvm/versions/1.20.2/bin/cache/dart-sdk/lib/core/uri.dart:3259:39 - Expected an identifier.
[INFO] 1.6s elapsed, 1/12 actions completed.
[INFO] 2.6s elapsed, 1/12 actions completed.
[INFO] 3.7s elapsed, 1/12 actions completed.
[INFO] 4.7s elapsed, 1/12 actions completed.
[INFO] 5.8s elapsed, 1/12 actions completed.
[INFO] 6.9s elapsed, 1/12 actions completed.
[INFO] 8.0s elapsed, 1/12 actions completed.
[INFO] 9.0s elapsed, 1/12 actions completed.
[INFO] 10.0s elapsed, 1/12 actions completed.
[INFO] 11.1s elapsed, 1/12 actions completed.
[INFO] 12.1s elapsed, 1/12 actions completed.
[INFO] 13.2s elapsed, 1/12 actions completed.
[INFO] 14.2s elapsed, 1/12 actions completed.
[INFO] 15.2s elapsed, 1/12 actions completed.
[WARNING] No actions completed for 15.1s, waiting on:
  - freezed:freezed on lib/main.dart
  - freezed:freezed on lib/app.dart
  - freezed:freezed on lib/presentation/common/colors.dart
  - freezed:freezed on lib/presentation/pages/home/home_page.dart
  - freezed:freezed on lib/presentation/pages/index.dart
  .. and 6 more

```

## やること
- `pubspec.yaml` を変更する
- きれいにする
- buildし直す

※ fvmを使用されていない場合はfvmの部分を消して実行してください

### `pubspec.yaml` を変更する
```pubspec.yaml
dependencies:
  analyzer: ^0.39.14 <- 追加

dev_dependencies:
  build_runner: ^1.10.0 <- 追加
```

### きれいにする
```sh
# pubspec.lockを削除
$ rm -rf pubspec.lock

# clean
$ fvm flutter clean
Cleaning Xcode workspace...                                         2.9s
Deleting .dart_tool...                                               3ms
Deleting Generated.xcconfig...                                       0ms
Deleting flutter_export_environment.sh...                            0ms
```

### buildし直す
```sh
# pub get
$ fvm flutter pub get
Running "flutter pub get" in my_project...                          2.5s

# build_runnerを実行
$ fvm flutter packages pub run build_runner build --delete-conflicting-outputs
Precompiling executable...
Precompiled build_runner:build_runner.
[INFO] Generating build script...

[...]

[INFO] Succeeded after 18.8s with 1 outputs (12 actions)
```


fvmを使用されていない場合は記述不要です！

### 参考
https://github.com/flutter/flutter/issues/63096