[flutter_tools] Handle null version gracefully in CachedArtifact and MaterialFonts (#191494)
When artifact version files (such as `bin/internal/material_fonts.version`) are missing or cannot be resolved, `CachedArtifact.version` evaluates to `null`. Previously, `CachedArtifact.update` invoked `updateInner` before checking if `version` was `null`, causing `MaterialFonts.updateInner` (and other artifact subclasses) to evaluate `version!` and throw an unhandled `TypeError` / `_CastError` with `Null check operator used on a null value`. This change: 1. Returns early with a warning in `CachedArtifact.update` before attempting `updateInner` or writing stamps when `version == null`. 2. Guards against `version == null` in `MaterialFonts`, `GradleWrapper`, and `FlutterRunnerDebugSymbols`. 3. Adds an automated regression test in `cache_test.dart`. Fixes #90092
B
Ben Konyi committed
0c0d0594def51d98e189361cb09ad4e7dae5daa7
Parent: 2483da2
Committed by GitHub <noreply@github.com>
on 8/24/2026, 5:31:10 PM