Repository navigation
Conversation
TextField (from `material_ui`, used throughout this app instead of
`flutter/material`) crashes with "Null check operator used on a null
value" in `_TextFieldState._getEffectiveDecoration` for any non-English
locale, on the very first screen with a text field (onboarding, login).
`material_ui` ships its own MaterialLocalizations implementation,
separate from flutter_localizations'. `AppLocalizations.localizationsDelegates`
(the gen-l10n boilerplate) only registers flutter_localizations' delegates,
so material_ui's TextField can never find a MaterialLocalizations for a
locale other than the framework-eager-loaded English one. Debug builds
surface this plainly ("A MaterialLocalizations0 delegate that supports
the de locale was not found"); release/profile builds only show the
generic null-check crash since assertions are stripped.
Fix: also register material_ui's own `GlobalMaterialLocalizations.delegates`.
Found while testing item assignment (this commit's change is unrelated
to and predates that feature) - reproduces identically on unmodified
upstream main (7d50835), independent of GPU rendering, browser engine,
build mode and service-worker caching (all ruled out first). Root cause
confirmed via a source-mapped debug build.
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Author
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1163.
One-liner: also register
material_ui's ownGlobalMaterialLocalizations.delegatesinapp.dart, alongside the generatedAppLocalizations.localizationsDelegates.material_ui(used everywhere instead offlutter/material) ships its ownMaterialLocalizations/CupertinoLocalizations/WidgetsLocalizations, separate fromflutter_localizations', and only the latter was wired up.No import changes needed since
material_ui.dartis already imported unaliased inapp.dart, soGlobalMaterialLocalizationsthere resolves to its class.Tested German (and English, unaffected) in debug and release builds, Chrome/Firefox/Edge.
flutter analyzeclean, existing test suite passes.