Skip to content
Boring Doc
BreakingHigh impactOfficial migration guidesince 1.17.0landed 1.16.3

TestTextInput state reset

Framework · Official source

The state of a `TestTextInput` instance, a stub for the system's onscreen keyboard, is now reset between tests.

Original behavior

The Flutter test framework uses a class called `TestTextInput` to track and manipulate editing state in a widgets test. Individual tests can make calls that modify the internal state of this object, sometimes indirectly (such as by setting their own handlers on `SystemChannels.textInput`). Subsequent tests might then check the state of `WidgetTester.testTextInput` and get unexpected values.

New behavior

The state of `WidgetTester.testTextInput` is now reset before running a `testWidgets` test.

Who is affected
Applications and packages relying on the previous behaviour or signature. Code that uses TestTextInput, SystemChannels.textInput, WidgetTester.testTextInput 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.

Before and after (from the official guide)

dart+1−1
Before
1−expect(tester.testTextInput.editingState['text'], isEmpty);
After
1+expect(tester.testTextInput.editingState, isNull);
Raw before / after
expect(tester.testTextInput.editingState['text'], isEmpty);
expect(tester.testTextInput.editingState, isNull);
Official migration guide (excerpt, © The Flutter Authors, CC BY 3.0)

Tests that relied on dirty state from a previously run test must be updated. For example, the following test, from packages/flutter/test/material/text_field_test.dart in the 'Controller can update server' test, previously passed because of a combination of dirty state from previous tests and a failure to actually set state in cases where it should have been set.

Code before migration:

In a widgetsTest, before actually changing text on a text editing widget, this call might have succeeded:

    expect(tester.testTextInput.editingState['text'], isEmpty);

Code after migration:

Either remove the call entirely, or consider using the following to assert that the state hasn't been modified yet:

    expect(tester.testTextInput.editingState, isNull);
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 (95%)

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.

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?