Skip to content
Boring Doc
DeprecatedMedium impactOfficial migration guidesince 3.44.0landed 3.43.0-0.1.pre

Deprecate TextInputConnection.setStyle

Framework · Official source

`TextInputConnection.setStyle` is deprecated in favor of `TextInputConnection.updateStyle`, which supports synchronizing `letterSpacing`, `wordSpacing`, and `lineHeight` to the engine.

Original behavior

The previous `setStyle` method didn't support `letterSpacing`, `wordSpacing`, or `lineHeight`. This caused visual misalignment of the selection highlight and IME caret when these properties were used.

New behavior

Not stated in the source.

Who is affected
Code that still calls the deprecated API; it keeps working until removal but produces analyzer warnings. Code that uses TextInputConnection.setStyle, TextInputConnection.updateStyle, TextInputStyle.
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)

dart+11−6
Before
1−connection.setStyle(
2− fontFamily: 'Roboto',
3− fontSize: 14.0,
4− fontWeight: FontWeight.normal,
5− textDirection: TextDirection.ltr,
6− textAlign: TextAlign.start,
 
 
 
 
 
7 );
After
1+connection.updateStyle(
2+ TextInputStyle(
3+ fontFamily: 'Roboto',
4+ fontSize: 14.0,
5+ fontWeight: FontWeight.normal,
6+ textDirection: TextDirection.ltr,
7+ textAlign: TextAlign.start,
8+ letterSpacing: 1.2,
9+ wordSpacing: 1.0,
10+ lineHeight: 1.5,
11+ ),
12 );
Raw before / after
connection.setStyle(
  fontFamily: 'Roboto',
  fontSize: 14.0,
  fontWeight: FontWeight.normal,
  textDirection: TextDirection.ltr,
  textAlign: TextAlign.start,
);
connection.updateStyle(
  TextInputStyle(
    fontFamily: 'Roboto',
    fontSize: 14.0,
    fontWeight: FontWeight.normal,
    textDirection: TextDirection.ltr,
    textAlign: TextAlign.start,
    letterSpacing: 1.2,
    wordSpacing: 1.0,
    lineHeight: 1.5,
  ),
);
Official migration guide (excerpt, © The Flutter Authors, CC BY 3.0)

If you author a custom text input client, replace calls to TextInputConnection.setStyle with TextInputConnection.updateStyle.

Code before migration

connection.setStyle(
  fontFamily: 'Roboto',
  fontSize: 14.0,
  fontWeight: FontWeight.normal,
  textDirection: TextDirection.ltr,
  textAlign: TextAlign.start,
);

Code after migration

connection.updateStyle(
  TextInputStyle(
    fontFamily: 'Roboto',
    fontSize: 14.0,
    fontWeight: FontWeight.normal,
    textDirection: TextDirection.ltr,
    textAlign: TextAlign.start,
    letterSpacing: 1.2,
    wordSpacing: 1.0,
    lineHeight: 1.5,
  ),
);
Migration assistantAI-generated · grounded in cited sources
AI explanations are not configured
Set 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.
Official migration guide·Verified classification (90%)

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 explanationAI-generated · grounded in cited sources
AI explanations are not configured
Set 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.
Was this useful?