Error during compilation of a Flutter app for Windows: Type 'UnmodifiableUint8ListView' not found
Asked Answered
O

9

7

I created a Flutter project, that targets Android, iOS, macOS, Linux and Windows.

It works well on both Android and iOS, but when I try to compile it on Windows 10, I got the following error:

/C:/Users/Matt/AppData/Local/Pub/Cache/hosted/pub.dev/win32-5.5.0/lib/src/guid.dart(32,9): error G7D2AEF3C: Type 'UnmodifiableUint8ListView' not found. [D:\Projects\MyProject\myproject\build\windows\x64\flutter\flutter_assemble.vcxproj]
/C:/Users/Matt/AppData/Local/Pub/Cache/hosted/pub.dev/win32-5.5.0/lib/src/guid.dart(32,9): error G94EA939C: 'UnmodifiableUint8ListView' isn't a type. [D:\Projects\MyProject\myproject\build\windows\x64\flutter\flutter_assemble.vcxproj]
/C:/Users/Matt/AppData/Local/Pub/Cache/hosted/pub.dev/win32-5.5.0/lib/src/guid.dart(52,17): error GB1B8BC88: Method not found: 'UnmodifiableUint8ListView'. [D:\Projects\MyProject\myproject\build\windows\x64\flutter\flutter_assemble.vcxproj]
/C:/Users/Matt/AppData/Local/Pub/Cache/hosted/pub.dev/win32-5.5.0/lib/src/guid.dart(56,31): error GB1B8BC88: Method not found: 'UnmodifiableUint8ListView'. [D:\Projects\MyProject\myproject\build\windows\x64\flutter\flutter_assemble.vcxproj]
/C:/Users/Matt/AppData/Local/Pub/Cache/hosted/pub.dev/win32-5.5.0/lib/src/guid.dart(100,17): error GB1B8BC88: Method not found: 'UnmodifiableUint8ListView'. [D:\Projects\MyProject\myproject\build\windows\x64\flutter\flutter_assemble.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio\2019\BuildTools\MSBuild\Microsoft\VC\v160\Microsoft.CppCommon.targets(241,5): error MSB8066: la build personnalisée de 'D:\Projects\MyProject\myproject\build\windows\x64\CMakeFiles\00f4297bda59febfcdc266bbd2530f6d\flutter_windows.dll.rule;D:\Projects\MyProject\myproject\build\windows\x64\CMakeFiles\785f825a0ac974305d35d5e7685e38b2\flutter_assemble.rule' s'est arrêtée. Code�1. [D:\Projects\MyProject\myproject\build\windows\x64\flutter\flutter_assemble.vcxproj]

I tried flutter clean then flutter pub get but the bug remains.

Has anyone encountered this error? How can I fix that?

Thanks.

Oxytetracycline answered 25/6 at 19:24 Comment(2)
Make sure you are in 5.5.1 (5.5.1 Migrate away from UnmodifiableUint8ListView (#850))Seymourseys
@RichardHeap Oh ok, I'll try that out, thanks!Oxytetracycline
O
9

OK so here is what I did to fix the problem:

  • check here that every dependency I have in my project that depends on win32 is up to date
  • run flutter pub upgrade win32
Oxytetracycline answered 26/6 at 17:2 Comment(0)
S
3

I've used this command and it finally resolved the problem

flutter pub upgrade win32
Selfabasement answered 7/8 at 9:59 Comment(0)
N
2

Dart 3.5.0 has a breaking change causing the issue) that deprecates the UnmodifiableUint8ListView class. This was pushed to the stable version of flutter on August 7th 2024.

Hopefully any packages that rely on this class have been upgraded or will be soon e.g. the latest versions of the win32, and archive packages have been upgraded, and libraries like tflite are working on it

The error message will tell you which package is still using the deprecated class

Upgrade all your packages using the flutter pub upgrade command

Nomination answered 19/7 at 8:55 Comment(0)
B
2

Follow the steps below to fix the issue. Run the following commands in your project:

  1. flutter pub upgrade win32 then
  2. flutter clean and finally
  3. flutter pub get

I hope this helps. Happy coding!!

Blida answered 7/8 at 17:46 Comment(2)
Type 'UnmodifiableUint8ListView' not found.Alethiaaletta
Check which package is still using this deprecated class, and try upgrade thatNomination
C
0

Perhaps your project was created a long time ago, as it was for me, and it helped to solve the problem by updating packages to modern versions with the command

flutter pub upgrade --major-versions
Collincolline answered 7/8 at 19:2 Comment(0)
P
0

Incase the above solutions did not work and you are in a rush, try these 3 steps:

flutter pub cache clean
flutter channel stable
flutter pub get
Piderit answered 27/8 at 4:6 Comment(0)
B
0

This is what worked for me to fix the same issue, but running on Android.

flutter pub cache clean
flutter pub get
flutter pub upgrade
flutter pub get
flutter run

Original: https://github.com/jonataslaw/get_cli/issues/263

Brana answered 27/8 at 9:14 Comment(0)
N
0

This works for me:

  1. flutter pub cache clean
  2. flutter pub get
  3. flutter pub upgrade
Norrie answered 1/10 at 13:16 Comment(0)
C
0

You can solve it by either:

flutter pub upgrade win32

or:

flutter pub upgrade
Canoness answered 3/10 at 2:11 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.