Skip to content

Commit

Permalink
fix BadPaddingException on some android. mogol/flutter_secure_storage…
Browse files Browse the repository at this point in the history
  • Loading branch information
pphetra committed Oct 29, 2023
1 parent fdf8cf1 commit 3a4b199
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 2 additions & 0 deletions android/app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
android:name="${applicationName}"
android:icon="@mipmap/launcher_icon"
android:networkSecurityConfig="@xml/network_security_config"
android:allowBackup="false"
android:fullBackupContent="false"
>
<activity
android:name=".MainActivity"
Expand Down
9 changes: 8 additions & 1 deletion lib/services/secure_storage_service.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import 'dart:convert';
import 'dart:io';

import 'package:flutter/services.dart';
import 'package:flutter_secure_storage/flutter_secure_storage.dart';
import 'package:podd_app/models/login_result.dart';
import 'package:podd_app/models/user_profile.dart';
Expand All @@ -23,7 +25,12 @@ class SecureStorageService implements ISecureStorageService {

@override
Future<String?> get(String key) async {
return storage.read(key: key);
try {
return storage.read(key: key);
} on PlatformException catch (e) {
await storage.deleteAll();
return null;
}
}

@override
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ publish_to: "none" # Remove this line if you wish to publish to pub.dev
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.0.3+64
version: 1.0.3+65

environment:
sdk: ">=2.18.0 <3.0.0"
Expand Down

0 comments on commit 3a4b199

Please sign in to comment.