flutter_secure_storage icon indicating copy to clipboard operation
flutter_secure_storage copied to clipboard

[Mobile] Getting Flutter_secure_storage_windows Error

Open wibowoCodeId opened this issue 1 year ago • 9 comments

I got an error when i just using mobile for flutter_secure_storage_windows.

Here the error

/C:/Users/fauzi/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_secure_storage_windows-3.0.0/lib/src/flutter_secure_storage_windows_ffi.dart:253:45:` Error: The argument type 'Pointer<Uint8>' can't be assigned to the parameter type 'int'.

  • 'Pointer' is from 'dart:ffi'.
  • 'Uint8' is from 'dart:ffi'. if (LocalFree(plainTextBlob.ref.pbData).address != NULL) { ^ /C:/Users/fauzi/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_secure_storage_windows-3.0.0/lib/src/flutter_secure_storage_windows_ffi.dart:253:53: Error: The getter 'address' isn't defined for the class 'int'. Try correcting the name to the name of an existing getter, or defining a getter or field named 'address'. if (LocalFree(plainTextBlob.ref.pbData).address != NULL) { ^^^^^^^ /C:/Users/fauzi/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_secure_storage_windows-3.0.0/lib/src/flutter_secure_storage_windows_ffi.dart:371:47: Error: The argument type 'Pointer<Uint8>' can't be assigned to the parameter type 'int'.
  • 'Pointer' is from 'dart:ffi'.
  • 'Uint8' is from 'dart:ffi'. if (LocalFree(encryptedTextBlob.ref.pbData).address != NULL) { ^ /C:/Users/fauzi/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_secure_storage_windows-3.0.0/lib/src/flutter_secure_storage_windows_ffi.dart:371:55: Error: The getter 'address' isn't defined for the class 'int'. Try correcting the name to the name of an existing getter, or defining a getter or field named 'address'. if (LocalFree(encryptedTextBlob.ref.pbData).address != NULL) { ^^^^^^^ Target kernel_snapshot failed: Exception

FAILURE: Build failed with an exception.

  • Where: Script 'C:\Flutter\main\packages\flutter_tools\gradle\src\main\groovy\flutter.groovy' line: 1297

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

Process 'command 'C:\Flutter\main\bin\flutter.bat'' finished with non-zero exit value 1 `

I just using this for Mobile Version. And this i got when running the mobile version

wibowoCodeId avatar Aug 31 '23 09:08 wibowoCodeId

@wibowoCodeId Please provide minimal reproducable code.

mshahjahan-mufin avatar Aug 31 '23 12:08 mshahjahan-mufin

@wibowoCodeId Please provide minimal reproducable code.

Here the code i using this secure storage to secure the hive key.

Future<List<int>> hiveKeys() async {
  const FlutterSecureStorage ss = FlutterSecureStorage();

  const AndroidOptions aOptions = AndroidOptions(
    encryptedSharedPreferences: true,
  );

  const IOSOptions iOptions = IOSOptions(
    accessibility: KeychainAccessibility.first_unlock,
  );
  String? stringKey = await ss.read(
    key: 'boxKey',
    aOptions: aOptions,
    iOptions: iOptions,
  );
  late List<int> hiveKey;
  if (stringKey != null) {
    hiveKey = stringKey.codeUnits;
  } else {
    hiveKey = Hive.generateSecureKey();
    final Uint8List bytes = Uint8List.fromList(hiveKey);
    stringKey = String.fromCharCodes(bytes);
    await ss.write(
      key: 'boxKey',
      value: stringKey,
      aOptions: aOptions,
      iOptions: iOptions,
    );
  }
  return hiveKey;
}

wibowoCodeId avatar Sep 01 '23 01:09 wibowoCodeId

Same issue

mfurkanyuceal avatar Sep 05 '23 15:09 mfurkanyuceal

some issue

dorukatak avatar Sep 19 '23 08:09 dorukatak

Is there a solution to the problem?

Mina-Nashaat10 avatar Oct 18 '23 11:10 Mina-Nashaat10

just delete the folder "/C:/Users/fauzi/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_secure_storage_windows-3.0.0"

and it will work.

JamesBrel avatar Nov 16 '23 00:11 JamesBrel

Is there a solution to the problem?

just delete the folder "/C:/Users/fauzi/AppData/Local/Pub/Cache/hosted/pub.dev/flutter_secure_storage_windows-3.0.0"

and it will work.

JamesBrel avatar Nov 16 '23 00:11 JamesBrel

if you put the dependencies_override : win32 , remove it , it is the solution

JamesBrel avatar Nov 16 '23 09:11 JamesBrel

if you put the dependencies_override : win32 , remove it , it is the solution

in my case i have win32 under the dependencies_override, but i have just upgraded it to : win32: ^5.0.0, and it worked for me.

Nader2004 avatar Dec 05 '23 11:12 Nader2004

I am closing all older issues. If this issue still exists in the latest version, please let me know.

juliansteenbakker avatar Aug 13 '24 20:08 juliansteenbakker