Flutter アプリを Color.withOpacity から Color.withValues へ移行する (Flutter 3.27 以降)
非推奨になった Color.withOpacity、opacity、value、red、green、blue、alpha を withValues、.a/.r/.g/.b、toARGB32 に置き換えます。dart fix が書き換える範囲、書き換えずに残す 4 つのゲッター、置き換え後に色の厳密なアサーションと Map<Color, T> の検索が壊れる理由、そして withOpacity が Display P3 を黙って失わせる仕組みを解説します。Flutter 3.44.8 と Dart 3.12.2 で検証しました。