Ad

Flutter Error: 'UnmodifiableUint8ListView' Is Restricted And Can't Be Extended Or Implemented

- 1 answer

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.

Ad

Answer

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.

Ad
source: stackoverflow.com
Ad