37

Screenshot of the requirements file

/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/utf8.dart:63:33: Error: The getter 'addressOf' isn't defined for the class 'Utf8'.

'Utf8' is from 'package:ffi/src/utf8.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/ffi-0.1.3/lib/src/utf8.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'addressOf'. String toString() => fromUtf8(addressOf); ^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_svg-0.18.1/lib/src/picture_provider.dart:50:59: Error: No named parameter with the name 'nullOk'. context != null ? Localizations.localeOf(context, nullOk: true) : null, ^^^^^^ /C:/src/flutter/packages/flutter/lib/src/widgets/localizations.dart:413:17: Context: Found this candidate, but the arguments don't match. static Locale localeOf(BuildContext context) { ^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/path_provider_windows-0.0.4+3/lib/src/path_provider_windows_real.dart:126:25: Error: The getter 'addressOf' isn't defined for the class 'GUID'.

'GUID' is from 'package:win32/src/structs.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'addressOf'. knownFolderID.addressOf, KF_FLAG_DEFAULT, NULL, pathPtrPtr); ^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:1067:7: Error: The getter 'addressOf' isn't defined for the class 'LOGFONT'.

'LOGFONT' is from 'package:win32/src/structs.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'addressOf'. addressOf.cast().elementAt(28).cast(); ^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:1112:29: Error: The getter 'addressOf' isn't defined for the class 'ENUMLOGFONTEX'.

'ENUMLOGFONTEX' is from 'package:win32/src/structs.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'addressOf'. LOGFONT get elfLogFont => addressOf.cast().ref; ^^^^^^^^^ /C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart:1114:29: Error: The getter 'addressOf' isn't defined for the class 'ENUMLOGFONTEX'.

'ENUMLOGFONTEX' is from 'package:win32/src/structs.dart' ('/C:/src/flutter/.pub-cache/hosted/pub.dartlang.org/win32-1.7.4+1/lib/src/structs.dart'). Try correcting the name to the name of an existing getter, or defining a getter or field named 'addressOf'. String get elfFullName => addressOf ^^^^^^^^^

FAILURE: Build failed with an exception.

  • Where: Script 'C:\src\flutter\packages\flutter_tools\gradle\flutter.gradle' line: 1035

  • What went wrong: Execution failed for task ':app:compileFlutterBuildDebug'. Process 'command 'C:\src\flutter\bin\flutter.bat'' 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.

  • Get more help at https://help.gradle.org

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

Richard Heap
  • 48,344
  • 9
  • 130
  • 112
Maychine
  • 417
  • 1
  • 4
  • 6
  • You probably have the `ffi` package constrained to < 1 in your pubspec.yaml. Check in your pubspec.lock what versions are resolved for win32 and ffi. – Richard Heap May 22 '21 at 17:49
  • For the future try making you question description shorter, people are more likely to answer a short yet clear question. Good lock coding :) – SilkeNL May 22 '21 at 19:37

9 Answers9

97

I got this error today. Here is what I did,

  1. Deleted .idea folder and build folder as well as pubspec-lock file.
  2. run flutter pub get

After these 2 simple steps, Project compiled without any errors.

Dasunx
  • 2,270
  • 1
  • 12
  • 7
24

I find solution. Delete those file from folder

".idea" file

"build" file

"pubspec-lock" file.

After delete "flutter clean" form terminal. Then "pub get".

AK IJ
  • 492
  • 4
  • 10
  • Thanks after receiving a project from a collegue developing on windows, I couldn't get the project to run on linux with a supposedly newer flutter toolchain. After setting dependency overrides for flutter_svg, intl, image and xml packages, your solution was the last stepstone to an apk. – JackLeEmmerdeur Jul 01 '21 at 21:08
16
  1. flutter clean
  2. flutter pub get
  3. flutter pub upgrade
Spatz
  • 18,640
  • 7
  • 62
  • 66
14

You should search which dependency broke your build :

flutter pub deps

Find globally win32 in the result, and take the faulty dependency.

For me, it was path_provider:

|-- path_provider 1.6.18 <- Latest version 2.0.1
|   |-- flutter...
|   |-- path_provider_linux 0.0.1+2
|   |   |-- flutter...
|   |   |-- path...
|   |   |-- path_provider_platform_interface...
|   |   '-- xdg_directories 0.1.2
|   |       |-- meta...
|   |       |-- path...
|   |       '-- process 4.1.0
|   |           |-- file...
|   |           |-- path...
|   |           '-- platform...
|   |-- path_provider_macos 0.0.4+4
|   |   '-- flutter...
|   |-- path_provider_platform_interface 1.0.3
|   |   |-- flutter...
|   |   |-- meta...
|   |   |-- platform 3.0.0
|   |   '-- plugin_platform_interface...
|   '-- path_provider_windows 0.0.4+1
|       |-- ffi 0.1.3
|       |-- flutter...
|       |-- meta...
|       |-- path...
|       |-- path_provider_platform_interface...
|       '-- win32 1.7.3 <--- Here
|           '-- ffi...

Go to https://pub.dev/ and take the latest version. Then, make futter clean && flutter pub get and try to rebuild your app.

Rémy Lavergne
  • 164
  • 2
  • 7
8

Delete:

-> .idea folder
->  build folder 
->  pubspec-lock file.

Then:

run flutter pub get
Pang
  • 9,564
  • 146
  • 81
  • 122
Söhrab Vahidli
  • 587
  • 7
  • 10
1

Upgrading all the packages to the latest version fixed my issue. since it's been quite a while since I last opened this project.

ASAD HAMEED
  • 2,296
  • 1
  • 20
  • 36
1

first clean your Flutter Project and then run flutter pub get. hope it will work you else Follow these procedures

1. Delete .idea folder 2. Delete build folder 3. Delete pubspec-lock file.

after That again run this command flutter pub get

DONE

Raza Sheikh
  • 61
  • 1
  • 4
  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Mar 24 '22 at 07:18
0

You should search which dependency broke your build:

  1. first there is an android studio plugin "Flutter Enhancement suite" install it it will show you which dependency need to be update to newer version.
  2. Dependencies that are conflicting change them to any like cupertino_icons: ^1.0.2 auto_size_text: ^2.1.0 path_provider: any
  3. run pub get.
  4. go to pub pubspec.lock file
  5. search for dependencies version that you changed to any in step 2.
  6. replace versions in pubspec.yaml . and its done[enter image Flutter Enhancement suite][1]

how to upgrade dependencies within android studio

How to find perfect version for conflicting versions that we change with any

Spatz
  • 18,640
  • 7
  • 62
  • 66
Khurram
  • 173
  • 7
0

first of all delete these file one by one

.idea folder
build folder 
pubspec-lock file.

and then run the following commands:

flutter clean;flutter pub get;