问题描述
原本我在Mac开发的项目,现在win10运行时报如下错误:
../../../AppData/Local/Pub/Cache/hosted/pub.dev/win32-3.1.4/lib/src/guid.dart:31:9: Error: Type 'UnmodifiableUint8ListView' not found.
final UnmodifiableUint8ListView bytes;
^^^^^^^^^^^^^^^^^^^^^^^^^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/win32-3.1.4/lib/src/guid.dart:31:9: Error: 'UnmodifiableUint8ListView' isn't a type.
final UnmodifiableUint8ListView bytes;
^^^^^^^^^^^^^^^^^^^^^^^^^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/win32-3.1.4/lib/src/guid.dart:51:17: Error: Method not found: 'UnmodifiableUint8ListView'.
return Guid(UnmodifiableUint8ListView(guid));
^^^^^^^^^^^^^^^^^^^^^^^^^
../../../AppData/Local/Pub/Cache/hosted/pub.dev/win32-3.1.4/lib/src/guid.dart:55:31: Error: Method not found: 'UnmodifiableUint8ListView'.
AS运行Flutter Doctor正常
问题分析
需要将 win32 软件包版本升级到最新版本,或者运行 flutter pub upgrade
命令将正在使用的所有依赖项升级到最新版本,最终解决问题。
问题解决
方案一、降级Flutter
方案二、执行命令,以更新软件包
flutter pub upgrade win32
//如果 pub upgrade win32 无法正常工作,只需运行以下命令
flutter pub global activate -s git https://github.com/jonataslaw/get_cli
flutter pub cache clean
flutter channel stable
flutter clean && flutter pub get
flutter pub upgrade