ui.TextLeadingDistribution 在 chrome 或 macOS 上 运行 Flutter 应用程序时找不到

ui.TextLeadingDistribution not found when running Flutter app on chrome or macos

在使用 dart migrate 后尝试 运行 我的应用程序在 chrome 或 macos 上时,我在控制台中收到此错误:

Downloading Web SDK...                                           2,674ms
Launching lib/web/main.dev.dart on Chrome in debug mode...
Waiting for connection from debug service on Chrome...          
../../../.pub-cache/hosted/pub.dartlang.org/styled_text-3.0.1/lib/custom_style.dart:38:7: Error: Type 'ui.TextLeadingDistribution' not found.
      ui.TextLeadingDistribution? leadingDistribution,
      ^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dartlang.org/styled_text-3.0.1/lib/custom_style.dart:98:7: Error: Type 'ui.TextLeadingDistribution' not found.
      ui.TextLeadingDistribution? leadingDistribution,
      ^^^^^^^^^^^^^^^^^^^^^^^^^^
../../../.pub-cache/hosted/pub.dartlang.org/styled_text-3.0.1/lib/custom_style.dart:219:3: Error: Type 'ui.TextLeadingDistribution' not found.
  ui.TextLeadingDistribution? get leadingDistribution =>

在 Android / iPhone 模拟器上 运行 没问题。
我尝试了以下但都是徒劳的:

  1. flutter 2.0.6(稳定)
  2. flutter 2.5.3(稳定)
  3. flutter doctor 没有任何问题
  4. flutter clean, flutter pub 缓存修复, flutter pub get
  5. 重启VSCode

实际上,问题出在依赖项 styled_text。
我只从存储库中复制了我们需要的文件并解决了问题。