flutter_secure_storage
flutter_secure_storage copied to clipboard
FlutterError - ParallelWaitError: Instance of 'StorageException' on iOS
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
- Add
flutter_secure_storage9.2.2 version to yourpubspec.yaml - Initialise
flutter_secure_storagein your Flutter application:
final storage = FlutterSecureStorage(
aOptions: AndroidOptions(
encryptedSharedPreferences: true,
resetOnError: true,
...
),
)
- 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);
}
}
- 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