Skip to content

[Tool] Unconditional Null Assertion on Isolate.packageConfigSync #188449

Description

@bkonyi

This issue is one of the top crashers identified in the Flutter 3.44.3 stable release.


The Flutter tool crashes with Null check operator used on a null value in sandboxed or package-managed environments (such as NixOS or stand-alone AOT runs).

Root Cause

In package_map.dart, currentPackageConfig unconditionally asserts Isolate.packageConfigSync!. However, this property can be null if the isolate was spawned without package configuration metadata.

Proposed Solution

  1. Remove the strict null assertion.
  2. Implement a robust fallback: if null, it attempts to resolve .dart_tool/package_config.json relative to the CWD and then the executing script.
  3. If all fail, it throws a clean ToolExit prompting the user to run flutter pub get instead of a raw runtime crash.

Metadata

Metadata

Assignees

Labels

P2Important issues not at the top of the work listteam-toolOwned by Flutter Tool teamtriaged-toolTriaged by Flutter Tool team

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions