The `color` parameter in `AppBarTheme` and `AppBarThemeData` constructors and their `copyWith` methods have been deprecated. Use `backgroundColor` instead. This change affects how AppBar themes are configured and might cause deprecation warnings in existing code.
- Who is affected
- Code that still calls the deprecated API; it keeps working until removal but produces analyzer warnings. Code that uses AppBarTheme, AppBarThemeData, AppBarTheme.copyWith and related APIs.
- Practical impact
- Warnings now; removal in a future release. Plan the migration but no immediate break.
- 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.
Before and after (from the official guide)
| 1 | // AppBarTheme constructor | |
| 2 | AppBarTheme( | |
| 3 | − | color: Colors.blue, |
| 4 | elevation: 4.0, | |
| 5 | ) | |
| 6 | ||
| 7 | // AppBarTheme copyWith | |
| 8 | theme.copyWith( | |
| 9 | − | color: Colors.red, |
| 10 | elevation: 2.0, | |
| 11 | ) | |
| 12 | ||
| 13 | // AppBarThemeData constructor | |
| 14 | AppBarThemeData( | |
| 15 | − | color: Colors.green, |
| 16 | elevation: 4.0, | |
| 17 | ) | |
| 18 | ||
| 19 | // AppBarThemeData copyWith | |
| 20 | themeData.copyWith( | |
| 21 | − | color: Colors.purple, |
| 22 | elevation: 2.0, | |
| 23 | ) |
| 1 | // AppBarTheme constructor | |
| 2 | AppBarTheme( | |
| 3 | + | backgroundColor: Colors.blue, |
| 4 | elevation: 4.0, | |
| 5 | ) | |
| 6 | ||
| 7 | // AppBarTheme copyWith | |
| 8 | theme.copyWith( | |
| 9 | + | backgroundColor: Colors.red, |
| 10 | elevation: 2.0, | |
| 11 | ) | |
| 12 | ||
| 13 | // AppBarThemeData constructor | |
| 14 | AppBarThemeData( | |
| 15 | + | backgroundColor: Colors.green, |
| 16 | elevation: 4.0, | |
| 17 | ) | |
| 18 | ||
| 19 | // AppBarThemeData copyWith | |
| 20 | themeData.copyWith( | |
| 21 | + | backgroundColor: Colors.purple, |
| 22 | elevation: 2.0, | |
| 23 | ) |
Raw before / after
// AppBarTheme constructor AppBarTheme( color: Colors.blue, elevation: 4.0, ) // AppBarTheme copyWith theme.copyWith( color: Colors.red, elevation: 2.0, ) // AppBarThemeData constructor AppBarThemeData( color: Colors.green, elevation: 4.0, ) // AppBarThemeData copyWith themeData.copyWith( color: Colors.purple, elevation: 2.0, )
// AppBarTheme constructor AppBarTheme( backgroundColor: Colors.blue, elevation: 4.0, ) // AppBarTheme copyWith theme.copyWith( backgroundColor: Colors.red, elevation: 2.0, ) // AppBarThemeData constructor AppBarThemeData( backgroundColor: Colors.green, elevation: 4.0, ) // AppBarThemeData copyWith themeData.copyWith( backgroundColor: Colors.purple, elevation: 2.0, )
Official migration guide (excerpt, © The Flutter Authors, CC BY 3.0)
Replace all uses of the color parameter with backgroundColor in
AppBarTheme and AppBarThemeData constructors and copyWith methods.
Code before migration:
// AppBarTheme constructor
AppBarTheme(
color: Colors.blue,
elevation: 4.0,
)
// AppBarTheme copyWith
theme.copyWith(
color: Colors.red,
elevation: 2.0,
)
// AppBarThemeData constructor
AppBarThemeData(
color: Colors.green,
elevation: 4.0,
)
// AppBarThemeData copyWith
themeData.copyWith(
color: Colors.purple,
elevation: 2.0,
)Code after migration:
// AppBarTheme constructor
AppBarTheme(
backgroundColor: Colors.blue,
elevation: 4.0,
)
// AppBarTheme copyWith
theme.copyWith(
backgroundColor: Colors.red,
elevation: 2.0,
)
// AppBarThemeData constructor
AppBarThemeData(
backgroundColor: Colors.green,
elevation: 4.0,
)
// AppBarThemeData copyWith
themeData.copyWith(
backgroundColor: Colors.purple,
elevation: 2.0,
)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; title states deprecation.
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.
- 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.