OiO.lk Community platform!

Oio.lk is an excellent forum for developers, providing a wide range of resources, discussions, and support for those in the developer community. Join oio.lk today to connect with like-minded professionals, share insights, and stay updated on the latest trends and technologies in the development field.
  You need to log in or register to access the solved answers to this problem.
  • You have reached the maximum number of guest views allowed
  • Please register below to remove this limitation

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

  • Thread starter Thread starter matteoh
  • Start date Start date
M

matteoh

Guest
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:

Code:
/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.
<p>I created a Flutter project, that targets Android, iOS, macOS, Linux and Windows.</p>
<p>It works well on both Android and iOS, but when I try to compile it on Windows 10, I got the following error:</p>
<pre><code>/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]
</code></pre>
<p>I tried <code>flutter clean</code> then <code>flutter pub get</code> but the bug remains.</p>
<p>Has anyone encountered this error? How can I fix that?</p>
<p>Thanks.</p>
 
Last edited by a moderator:
This error is likely due to an incompatibility or missing dependency in the Flutter project, specifically related to the `win32` package. Here are a few steps you can try to resolve the issue:

1. **Update Dependencies**: Make sure all your dependencies are up to date. Run the following commands in your Flutter project directory:



Code:
flutter pub upgrade

    flutter pub get
```

2. **Check `win32` Package Version**: Ensure that you are using a compatible version of the `win32` package. The error might be due to an outdated or incompatible version of the `win32` package. Check the `pubspec.yaml` file for the `win32` package version and update it if necessary:



Code:
 dependencies:

      win32: ^5.5.0


Update the version to the latest version available.

3. **Update Flutter**: Ensure you are using the latest version of Flutter. Run the following commands:


Code:
flutter upgrade


4. **Check for Breaking Changes**: Check the [changelog](https://pub.dev/packages/win32/changelog) for the `win32` package to see if there are any breaking changes that might affect your project.

5. **Clear Cache**: Sometimes clearing the cache can help resolve such issues. Run the following commands:



Code:
flutter clean

    flutter pub cache repair

    flutter pub get


6. **Modify the Code**: If the above steps do not work, you might need to modify the code in the `guid.dart` file of the `win32` package. Locate the file and replace instances of `UnmodifiableUint8ListView` with `Uint8List` or the appropriate type.

Here's an example of how you might modify the code:



Code:
import 'dart:typed_data';



    // Replace UnmodifiableUint8ListView with Uint8List

    Uint8List _data;
```

However, be cautious when modifying package files, as these changes might be overwritten when updating the package.

If none of these steps resolve the issue, consider filing an issue on the [GitHub repository](https://github.com/timsneath/win32) for the `win32` package, providing details of your environment and the error logs.
 
Last edited:
The error you are encountering is related to the UnmodifiableUint8ListView type not being found in your Flutter project targeting Windows. This issue is often caused by incompatibilities or missing dependencies in the win32 package or in the Dart SDK.

Here are steps you can take to resolve this issue:

1. Update Dependencies

Ensure that all your dependencies are up-to-date. Run the following command to update your dependencies:


Code:
flutter pub upgrade<br>

2. Check Dart SDK Version

Make sure you are using a compatible version of the Dart SDK. The UnmodifiableUint8ListView class was introduced in Dart 2.10.0, so ensure your Dart SDK is at least version 2.10.0.

You can check your Dart SDK version by running:



Code:
dart --version<br>
If your Dart SDK is outdated, update Flutter and Dart to the latest stable versions:



Code:
flutter upgrade<br>

3. Adjust the win32 Package Version

There might be an issue with the win32 package version you are using. You can try specifying a different version in your pubspec.yaml file. Open pubspec.yaml and change the win32 dependency to a compatible version:



Code:
<span>dependencies:</span><br>  <span>flutter:</span><br>    <span>sdk:</span> <span>flutter</span><br>  <span>win32:</span> <span>^2.0.0</span><br>



Code:
flutter pub get<br>

4. Clear the Pub Cache

Sometimes, clearing the pub cache can resolve issues related to corrupted or outdated packages. Run the following commands:



Code:
flutter pub cache repair<br>flutter clean<br>flutter pub get<br>

5. Check the guid.dart File

If the issue persists, you can manually check the guid.dart file in the win32 package for the presence of UnmodifiableUint8ListView. You can try replacing it with a compatible class or method if necessary.

Navigate to the guid.dart file at C:/Users/Matt/AppData/Local/Pub/Cache/hosted/pub.dev/win32-5.5.0/lib/src/guid.dart and inspect the lines that are causing errors.

6. Use Compatibility Mode

Ensure that your project is compatible with Windows by using the compatibility_mode parameter in your CMakeLists.txt file. Add the following line:



Code:
set_property(TARGET ${PROJECT_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$&lt;$&lt;CONFIG:Debug&gt;:Debug&gt;DLL")<br>

Example CMakeLists.txt Configuration

Ensure your CMakeLists.txt file looks something like this:



Code:
cmake_minimum_required(VERSION 3.10)<br>project(myproject)<br><br>set(PROJECT_NAME "myproject")<br>set(BUNDLE_IDENTIFIER "com.example.myproject")<br><br>set(CMAKE_CXX_STANDARD 17)<br><br>find_package(Flutter REQUIRED COMPONENTS desktop)<br><br># Define the project version.<br>set(PROJECT_VERSION 1.0.0)<br><br># Define the Dart SDK path.<br>set(DART_SDK_PATH "${FLUTTER_ROOT}/bin/cache/dart-sdk")<br><br># Set the output directory for the compiled binaries.<br>set(FLUTTER_BUILD_OUTPUT_DIR "${CMAKE_BINARY_DIR}/flutter")<br><br># Add the Flutter target.<br>add_executable(${PROJECT_NAME}<br>    "main.cpp"<br>    "my_application.cpp"<br>    "my_application.h"<br>)<br><br># Link the Flutter library.<br>target_link_libraries(${PROJECT_NAME} PRIVATE ${FLUTTER_LIBRARIES})<br><br># Add the project sources.<br>add_subdirectory(src)<br><br># Set properties for the target.<br>set_property(TARGET ${PROJECT_NAME} PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded$&lt;$&lt;CONFIG:Debug&gt;:Debug&gt;DLL")<br>
By following these steps, you should be able to resolve the UnmodifiableUint8ListView error and successfully compile your Flutter project on Windows 10. If the issue persists, consider reaching out to the Flutter or Dart community for further assistance.
 

Latest posts

O
Replies
0
Views
1
OrangeRind
O
D
Replies
0
Views
2
Domantas Giedraitis
D
Top