After running a flutter project this error message appears. flutter pub get also shows an error too shown below

31 Views Asked by At

flutter pub get shows the error:

/Users/sony/development/flutter/bin/flutter --no-color pub get Running "flutter pub get" in bedrive-flutter...
Warning: You are using these overridden dependencies:

! device_info_plus 8.2.2 (10.0.1 available)

! ffi 2.1.2

Running "flutter pub get" in bedrive-flutter... 5.6s Process finished with exit code 0

And running the app on android causes this error below:

Launching lib/main.dart on sdk gphone64 arm64 in debug mode... Running Gradle task 'assembleDebug'... ../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-2.1.2/lib/ffi.dart:1:1: Error: The specified language version is too high. The highest supported language version is 2.18. // Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file

^ ../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-2.1.2/lib/src/allocation.dart:1:1: Error: The specified language version is too high. The highest supported language version is 2.18. // Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file

^ ../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-2.1.2/lib/src/allocation.dart:48:1: Error: Can't have modifier 'final' here. Try removing 'final'.

final class MallocAllocator implements Allocator { ^^^^^ ../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-2.1.2/lib/src/allocation.dart:134:1: Error: Can't have modifier 'final' here. Try removing 'final'.

final class CallocAllocator implements Allocator { ^^^^^ ../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-2.1.2/lib/src/arena.dart:1:1: Error: The specified language version is too high. The highest supported language version is 2.18. // Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file

^ ../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-2.1.2/lib/src/utf8.dart:1:1: Error: The specified language version is too high. The highest supported language version is 2.18. // Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file

^ ../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-2.1.2/lib/src/utf8.dart:16:1: Error: Can't have modifier 'final' here. Try removing 'final'. final class Utf8 extends Opaque {}

^^^^^ ../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-2.1.2/lib/src/utf16.dart:1:1: Error: The specified language version is too high. The highest supported language version is 2.18. // Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file

^ ../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-2.1.2/lib/src/utf16.dart:16:1: Error: Can't have modifier 'final' here. Try removing 'final'. final class Utf16 extends Opaque {}

^^^^^ ../../../development/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-2.1.2/lib/src/utf16.dart:59:31: Error: The operator '+' isn't defined for the class 'Pointer'.

  • 'Pointer' is from 'dart:ffi'.
  • 'Uint16' is from 'dart:ffi'. Try correcting the operator to an existing operator, or defining a '+' operator. final char = (codeUnits + i).value; ^

FAILURE: Build failed with an exception.

  • Where: Script '/Users/sony/development/flutter/packages/flutter_tools/gradle/flutter.gradle' line: 1159

  • What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'.

Process 'command '/Users/sony/development/flutter/bin/flutter'' finished with non-zero exit value 1

  • Try:

Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.

BUILD FAILED in 11s Exception: Gradle task assembleDebug failed with exit code 1

1

There are 1 best solutions below

0
sanjay c On

consider updating packages to latest along with flutter