You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Flutter 3.7.12 Linux平台非空安全运行异常求助

Flutter非空安全项目在Linux平台运行异常问题

问题链接

https://github.com/flutter/flutter/issues/136791

复现步骤

  • 在Linux系统上安装并配置Flutter 3.7.12
  • 执行命令:flutter build linux --release --no-sound-null-safety 或 flutter run -d linux --no-sound-null-safety

实际运行情况

  • 基于Flutter 1.2开发的商业项目,多处未适配空安全特性,在Windows平台使用Flutter 3.7.12并添加@dart=2.9注解后可正常运行所有功能
  • 在X86架构Linux系统上配置相同版本Flutter 3.7.12后,项目能启动但因空检查异常导致大量功能无法使用
  • 因时间限制无法全面适配代码至空安全,且官方说明Flutter 3.7.12是最后支持非空安全的版本,希望找到无需修改代码即可在Linux平台正常运行的解决方案

错误日志

: getCustomXmlIcons failed or xml file not exist
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Failed assertion: boolean expression must not be null
#0      new AuthDirectManager.<anonymous closure>.<anonymous closure> (package:nova_login/manager/direct_auth_manager.dart:50)
<asynchronous suspension>

flutter: getCustomXmlIcons failed or xml file not exist
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Failed assertion: boolean expression must not be null
#0      new AuthDirectManager.<anonymous closure>.<anonymous closure> (package:nova_login/manager/direct_auth_manager.dart:50)
<asynchronous suspension>

[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: Failed assertion: boolean expression must not be null
#0      new AuthDirectManager.<anonymous closure>.<anonymous closure> (package:nova_login/manager/direct_auth_manager.dart:50)
<asynchronous suspension>

..
flutter: StandardAreaManager.getAreaList.usedLocalDeviceKeys length=0,localDeviceMap length=0
[ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: NoSuchMethodError: The method '+' was called on null.
Receiver: null
Tried calling: +()

Flutter Doctor 输出

flutter doctor -v
[✓] Flutter (Channel stable, 3.7.12, on Kylin V10 SP1 5.4.18-53-generic, locale zh_CN.UTF-8)
    • Flutter version 3.7.12 on channel stable at /home/it0/flutter/flutter_3.7.12
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 4d9e56e694 (6个月前), 2023-04-17 21:47:46 -0400
    • Engine revision 1a65d409c7
    • Dart version 2.19.6
    • DevTools version 2.20.1

[✗] Android toolchain - develop for Android devices
    ✗ Unable to locate Android SDK.
      Install Android Studio from: https://developer.android.com/studio/index.html
      On first launch it will assist you in installing the Android SDK components.
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).
      If the Android SDK has been installed to a custom location, please use
      `flutter config --android-sdk` to update to that location.


[✗] Chrome - develop for the web (Cannot find Chrome executable at google-chrome)
    ! Cannot find Chrome. Try setting CHROME_EXECUTABLE to a Chrome executable.

[✓] Linux toolchain - develop for Linux desktop
    • clang version 10.0.0-4kylin1
    • cmake version 3.16.3
    • ninja version 1.10.0
    • pkg-config version 0.29.1

[!] Android Studio (not installed)
    • Android Studio not found; download from https://developer.android.com/studio/index.html
      (or visit https://flutter.dev/docs/get-started/install/linux#android-setup for detailed instructions).

[✓] Connected device (1 available)
    • Linux (desktop) • linux • linux-x64 • Kylin V10 SP1 5.4.18-53-generic

已尝试的解决方案

  • 切换至Flutter 2.10.0和3.0.0版本,但均无法适配当前Linux设备

内容的提问来源于stack exchange,提问作者zzy

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.08 13:35:16