Fixing `error: ../../.pub-cache/hosted/pub.dev/win32-3.1.4/lib/src/guid.dart:31:9: Error: Type 'UnmodifiableUint8ListView' not found.`
Today I tried compiling my Flutter app in iOS and got this error:
error: ../../.pub-cache/hosted/pub.dev/win32-3.1.4/lib/src/guid.dart:31:9: Error: Type 'UnmodifiableUint8ListView' not found.
What does it mean? My app only compiles to iOS and Web. Googling this error, it seems like it is pretty recent. It popped up around June-Sept 2024.
Some highly upvoted ticket on GitHub recommends to set up a dependency override.
What's the root cause of it though? I don't think pub
has a why or explain command like npm
or yarn
. But it can still list transitive dependencies (pub deps docs):
% dart pub deps
Dart SDK 3.6.1
Flutter SDK 3.27.2
my_app 0.1.77+77
...
│ ├── wakelock_windows 0.2.1
│ │ ├── flutter...
│ │ ├── wakelock_platform_interface...
│ │ └── win32...
│ ├── flutter...
│ └── meta...
What's up with wakelock?
Uh ok. So it was replaced by https://pub.dev/packages/wakelock_plus and I should migrate to that instead.
The migration seems pretty painless, I replace Wakelock by WakelockPlus:
@override
void dispose() {
WakelockPlus.disable();
super.dispose();
}
@override
Widget build(BuildContext context) {
WakelockPlus.enable();
...
}