flutter_secure_storage icon indicating copy to clipboard operation
flutter_secure_storage copied to clipboard

FlutterError - ParallelWaitError: Instance of 'StorageException' on iOS

Open PabloTortosaLopez opened this issue 1 year ago • 0 comments

I am encountering a FlutterError - ParallelWaitError: Instance of 'StorageException' when using the flutter_secure_storage package to write data. This error occurs during the SecureStorage.write operation and ONLY on iOS. I can't find the root of the problem, it seems to fail randomly.

Steps to Reproduce

  1. Add flutter_secure_storage 9.2.2 version to your pubspec.yaml
  2. Initialise flutter_secure_storage in your Flutter application:
final storage = FlutterSecureStorage(
              aOptions: AndroidOptions(
                encryptedSharedPreferences: true,
                resetOnError: true,
               ...
              ),
            )
  1. Attempt to write data to secure storage
@override
  Future<void> write({required String key, required String value}) async {
    try {
      await storage.write(key: key, value: value);
    } catch (error, stackTrace) {
      Error.throwWithStackTrace(StorageException(error), stackTrace);
    }
  }
  1. Observe the error
Fatal Exception: FlutterError
0  ???                            0x0 StandardMethodCodec.decodeEnvelope + 648 (message_codecs.dart:648)
1  ???                            0x0 MethodChannel._invokeMethod + 334 (platform_channel.dart:334)
2  ???                            0x0 FlutterSecureStorage.write + 114 (flutter_secure_storage.dart:114)
3  ???                            0x0 SecureStorage.write + 49 (secure_storage.dart:49)

Additional Information Flutter Version: 3.24.2 flutter_secure_storage Version: 9.2.2 Platform: iOS

PabloTortosaLopez avatar Oct 11 '24 09:10 PabloTortosaLopez