Certain properties and methods in `CupertinoDynamicColor` were deprecated to align with the `Color` class due to wide gamut color spaces support added in Flutter 3.27.
Original behavior
The `Color` class was updated to support wide gamut color spaces, but some corresponding deprecations were not initially applied to `CupertinoDynamicColor` due to its implementation rather than due to the extension of `Color`.
New behavior
1. The `CupertinoDynamicColor.red` field is deprecated in favor of [`CupertinoDynamicColor.r`]. 1. The `CupertinoDynamicColor.green` is deprecated in favor of [`CupertinoDynamicColor.g`]. 1. The `CupertinoDynamicColor.blue` is deprecated in favor of [`CupertinoDynamicColor.b`]. 1. The `CupertinoDynamicColor.opacity` is deprecated in favor of [`CupertinoDynamicColor.a`]. 1. The `CupertinoDynamicColor.withOpacity()` is deprecated in favor of [`CupertinoDynamicColor.withValues()`].
- Who is affected
- Applications and packages relying on the previous behaviour or signature. Code that uses CupertinoDynamicColor, Color, CupertinoDynamicColor.red and related APIs.
- Practical impact
- Behaviour or API differences that can break builds or change runtime behaviour.
- What action should I take?
- Follow the official migration guide below, update affected call sites, run `dart fix --apply` where a fix is available, then run your tests.
Official migration guide (excerpt, © The Flutter Authors, CC BY 3.0)
Access color components
If your app accesses a single color component, consider taking advantage of the floating-point components. In the short term, you can scale the components themselves.
int _floatToInt8(double x) {
return (x * 255.0).round().clamp(0, 255);
}
const CupertinoDynamicColor color = CupertinoColors.systemBlue;
final intRed = _floatToInt8(color.r);
final intGreen = _floatToInt8(color.g);
final intBlue = _floatToInt8(color.b);Opacity
Before Flutter 3.27, Color had the concept of "opacity", which
showed up in the methods opacity and withOpacity().
Since Flutter 3.27, the alpha channel has been stored as a floating-point value.
Using .a and .withValues() will give the full expression of
a floating-point value and won't be quantized (restricted to a limited range).
That means "alpha" expresses the intent of "opacity" more correctly.
Migrate opacity
// Before: Access the alpha channel as a (converted) floating-point value.
final x = color.opacity;
// After: Access the alpha channel directly.
final x = color.a;Migrate withOpacity
// Before: Create a new color with the specified opacity.
final x = color.withOpacity(0.5);
// After: Create a new color with the specified alpha channel value,
// accounting for the current or specified color space.
final x = color.withValues(alpha: 0.5);AI_PROVIDER (for example to openai-compatible with a local Ollama or LM Studio endpoint) to enable grounded explanations. Everything else on this page works without an AI provider.Listed in the official breaking-changes index (docs.flutter.dev/release/breaking-changes).
An official announcement or migration guide documents an intended behaviour or API change. A verified source change (git diff) shows code changed but does not by itself prove a public API is breaking. AI interpretations are labelled and never used to classify a change.
- Official migration guide
- Implement wide gamut color support in the Framework
- CupertinoDynamicColor is missing deprecation notices
- Add missing deprecations to CupertinoDynamicColor
- Source commit
- b3045439b7c0
- Source last updated
- Oct 21, 2026
- Last synchronized
- Oct 21, 2026
- Publication status
- published
Publication history
- Oct 21, 2026, 8:31 PM: new → published (ingestion) — Backed by an official breaking-change/migration guide.
AI_PROVIDER (for example to openai-compatible with a local Ollama or LM Studio endpoint) to enable grounded explanations. Everything else on this page works without an AI provider.