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
- Remove the strict null assertion.
- Implement a robust fallback: if null, it attempts to resolve
.dart_tool/package_config.json relative to the CWD and then the executing script.
- If all fail, it throws a clean
ToolExit prompting the user to run flutter pub get instead of a raw runtime crash.
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 valuein sandboxed or package-managed environments (such as NixOS or stand-alone AOT runs).Root Cause
In
package_map.dart,currentPackageConfigunconditionally assertsIsolate.packageConfigSync!. However, this property can be null if the isolate was spawned without package configuration metadata.Proposed Solution
.dart_tool/package_config.jsonrelative to the CWD and then the executing script.ToolExitprompting the user to runflutter pub getinstead of a raw runtime crash.