halildurmus / win32

Access common Win32 APIs directly from Dart using FFI — no C required!
https://win32.pub
BSD 3-Clause "New" or "Revised" License
752 stars 123 forks source link

Compilation fails with 'InvalidType doesn't have nullability' #104

Closed aTeamSolace closed 3 years ago

aTeamSolace commented 3 years ago

/root/.pub-cache/hosted/pub.dartlang.org/win32-1.7.1/lib/src/generated/IWbemServices.dart:495:15: Error: 'NativeFunction' isn't a type. Pointer<NativeFunction<_ExecMethod_Native>>.fromAddress( ^^^^^^^^^^^^^^ /root/.pub-cache/hosted/pub.dartlang.org/win32-1.7.1/lib/src/generated/IWbemServices.dart:495:7: Error: Method not found: 'Pointer.fromAddress'. Pointer<NativeFunction<_ExecMethod_Native>>.fromAddress( ^^^^^^^^^^^

aTeamSolace commented 3 years ago

E:\Downloads\358\edu_2_web>flutter doctor -v [√] Flutter (Channel beta, 1.18.0-11.1.pre, on Microsoft Windows [Version 10.0.18362.1016], locale en-IN) • Flutter version 1.18.0-11.1.pre at E:\flutter_installation\flutter • Framework revision 2738a1148b (4 months ago), 2020-05-13 15:24:36 -0700 • Engine revision ef9215ceb2 • Dart version 2.9.0 (build 2.9.0-8.2.beta)

[√] Android toolchain - develop for Android devices (Android SDK version 29.0.3) • Android SDK at C:\Users\Shubham\AppData\Local\Android\Sdk • Platform android-30, build-tools 29.0.3 • ANDROID_HOME = C:\Users\Shubham\AppData\Local\Android\Sdk • Java binary at: C:\Program Files\Android\Android Studio\jre\bin\java • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04) • All Android licenses accepted.

[√] Chrome - develop for the web • Chrome at C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

[√] Android Studio (version 3.6) • Android Studio at C:\Program Files\Android\Android Studio • Flutter plugin version 49.0.1 • Dart plugin version 192.8052 • Java version OpenJDK Runtime Environment (build 1.8.0_212-release-1586-b04)

[√] VS Code (version 1.47.3) • VS Code at C:\Users\Shubham\AppData\Local\Programs\Microsoft VS Code • Flutter extension version 3.13.2

[√] Connected device (3 available) • Redmi 6A • c4f7ccd37d26 • android-arm • Android 9 (API 28) • Web Server • web-server • web-javascript • Flutter Tools • Chrome • chrome • web-javascript • Google Chrome 85.0.4183.102

• No issues found!

aTeamSolace commented 3 years ago

@timsneath I'm not using the win32 package but received this error and due to this my whole project is collapse please help mi to solve this issue

aTeamSolace commented 3 years ago

name: edu_2_web description: A new Flutter project.

publish_to: 'none' # Remove this line if you wish to publish to pub.dev

version: 1.0.0+1

environment: sdk: ">=2.7.0 <3.0.0"

dependencies: flutter: sdk: flutter

cupertino_icons: ^0.1.3 flutter_webview_plugin: ^0.3.11 curved_navigation_bar: ^0.3.2 google_fonts: ^1.0.0 fluttertoast: ^4.0.1 flutter_html: ^0.11.0 flutter_icons: ^1.0.0+1 line_icons: ^0.2.0 google_nav_bar: ^2.2.0 ff_navigation_bar: ^0.1.5 bottom_personalized_dot_bar: ^1.0.2 flutter_clean_calendar: ^1.0.2 fab_circular_menu: ^1.0.0 flutter_speed_dial: ^1.2.5 url_launcher: ^5.4.5 shared_preferences: ^0.5.6 loading: ^1.0.2 firebase_messaging: ^5.1.6 flutter_widget_from_html: ^0.3.3 flutter_svg: ^0.17.3 win32: ^1.6.10

dev_dependencies: flutter_test: sdk: flutter

flutter:

uses-material-design: true assets:

timsneath commented 3 years ago

This is a package for developing Windows apps, but you aren't targeting Windows. (You're running the beta channel of Flutter, which doesn't support Windows development, and you don't have any valid Windows targets enabled per flutter doctor.)

Let's start a step further back: what exactly are you trying to accomplish with the win32 package?

Schwusch commented 3 years ago

I got his problem since I have package:google_fonts in my project. I tried compiling for the web on master(updated some hour ago), dev, and beta channel. All fail this way. I tried to override win32 in my pubspec

dependency_overrides:
  win32: "1.6.9"

All the versions down to 1.6.9 before I gave up. I suspect it is a resolved dependency to win32 that might be the problem? I get miles of these kinds of logs:

../../../../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/wi
n32-1.6.9/lib/src/generated/IWbemServices.dart:510:15:
Error: 'NativeFunction' isn't a type.
      Pointer<NativeFunction<_ExecMethodAsync_Native>>.fromAddress(
              ^^^^^^^^^^^^^^
../../../../../snap/flutter/common/flutter/.pub-cache/hosted/pub.dartlang.org/wi
n32-1.6.9/lib/src/generated/IWbemServices.dart:510:7:
Error: Method not found: 'Pointer.fromAddress'.
      Pointer<NativeFunction<_ExecMethodAsync_Native>>.fromAddress(
      ^^^^^^^^^^^
Error: Compilation failed
Schwusch commented 3 years ago

I got around this problem by forcing package:path_provider to 1.6.14, the latest version without windows support:

dependency_overrides:
  path_provider: 1.6.14
timsneath commented 3 years ago

Oh OK, yeah, got it now. That's something @stuartmorgan is fixing on path_provider itself.

LucaIaconelli commented 3 years ago

I got around this problem by forcing package:path_provider to 1.6.14, the latest version without windows support:

dependency_overrides:
  path_provider: 1.6.14

Thank you very much, my web application had stopped working due to this error but this trick solved everything

aTeamSolace commented 3 years ago

I got around this problem by forcing package:path_provider to 1.6.14, the latest version without windows support:

dependency_overrides:
  path_provider: 1.6.14

Thank you.