halildurmus / filepicker_windows

File and directory picker for Windows that uses common dialog controls.
BSD 3-Clause "New" or "Revised" License
68 stars 19 forks source link

Method not found: 'GUID.fromString' #6

Closed hexaclue closed 3 years ago

hexaclue commented 3 years ago

I'm getting an error on every hot restart, on every hot reload, and also on every run:

../../../AppData/Local/Pub/Cache/hosted/pub.dartlang.org/filepicker_windows-2.0.0-nullsafety.0/lib/src/filedialog.dart:131:36: Error: Method not found: 'GUID.fromString'.
    final publicMusicFolder = GUID.fromString(folderGUID);
                                   ^^^^^^^^^^
vovahost commented 3 years ago

@HIHIQY1 The error is happening because the dependencies in pubspec.yaml are not using a fixed version. The GUID.fromString() method is removed in the newer version of the win32 package. You can replace the existing line: https://github.com/timsneath/filepicker_windows/blob/a763713c5c0cca4d08f8718cc434aefdaeacfb05/lib/src/filedialog.dart#L131

final publicMusicFolder = GUID.fromString(folderGUID);

with

final publicMusicFolder = GUID()..setGUID(folderGUID);

Another quicker fix is to force the package versions. In your pubspec.yaml add the following:

dependency_overrides:
  ffi: 0.2.0-nullsafety.1
  win32: 2.0.0-nullsafety.0
timsneath commented 3 years ago

Closing this, since the currently published version is in sync with the currently published version of ffi.