Flutter Error: 'UnmodifiableUint8ListView' is restricted and can't be extended or implemented

948

It might be related to breaking Dart changes https://github.com/dart-lang/sdk/issues/45115

With your second mac you have upgraded your Flutter and dart. (Also packages)

Simple solution is to downgrade Flutter/Dart. How to downgrade Flutter SDK (Dart 1.x)

Or find which package is causing it and upgrade/remove it.

Share:
948
Mohsen Namazi
Author by

Mohsen Namazi

Updated on January 01, 2023

Comments

  • Mohsen Namazi
    Mohsen Namazi over 1 year

    I'm building a FLutter code that has the following error for both Android and IOS:

    ../../development/flutter/.pub-cache/hosted/pub.dartlang.org/uuid_enhanced-3.0.2/lib/uuid.dart:9:7: Error: 'UnmodifiableUint8ListView' is restricted and can't be extended or 
    
    implemented.
    class Uuid extends UnmodifiableUint8ListView {
          ^
    
    
    FAILURE: Build failed with an exception.
    

    Flutter doctor status:

    [✓] Flutter (Channel stable, 2.5.2, on macOS 11.6 20G165 darwin-arm, locale
        en-DE)
    [✓] Android toolchain - develop for Android devices (Android SDK version 30.0.3)
    [✓] Xcode - develop for iOS and macOS
    [✓] Chrome - develop for the web
    [✓] Android Studio (version 2020.3)
    [✓] VS Code (version 1.61.0)
    [✓] Connected device (2 available)
    
    • No issues found!
    

    The code has no problem on my second MAC.

    Any idea how to solve this problem? I also attached the ymal file. The point is that this ymal file has no problem with the second MAC. And even when I am cloning the previous versions from Git, I am receiving the same error.

    • Adelina
      Adelina over 2 years
      Could you add your pubspec.yaml file? You have upgraded one of the libraries and it's causing this issue
  • Mohsen Namazi
    Mohsen Namazi over 2 years
    Thank you so much for the response... I tested both upgrading and downgrading but it is not working... The interesting point is other projects on the first mac have no problem with the building.
  • Adelina
    Adelina over 2 years
    Downgrade to same flutter/dart version as u have on ur other computer. Then do flutter doctor and flutter clean ur problem is caused by uuid_enhanced package - it's no longer maintained. Would suggest removing it and simply use uuid
  • Mohsen Namazi
    Mohsen Namazi over 2 years
    Unfortunately, the downgrading does not work... Do you mean to remove the uuid package from the root of the Flutter ask folder?
  • Mohsen Namazi
    Mohsen Namazi over 2 years
    I removed the Flutter folder and downloaded and installed the Flutter 2.2.3 and it fixed the problem.