Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions packages/flutter_secure_storage/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## 0.1.6

* Update flutter_secure_storage to 11.0.0.
* Update flutter_secure_storage_platform_interface to 2.0.3.
* Update minimum Flutter and Dart version to 3.32 and 3.8.

## 0.1.5

* Add an `implements` entry to the pubspec to improve discoverability on pub.dev.
Expand Down
4 changes: 2 additions & 2 deletions packages/flutter_secure_storage/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ This package is not an _endorsed_ implementation of `flutter_secure_storage`. Th

```yaml
dependencies:
flutter_secure_storage: ^10.0.0
flutter_secure_storage_tizen: ^0.1.5
flutter_secure_storage: ^11.0.0
flutter_secure_storage_tizen: ^0.1.6
```

Then you can import `flutter_secure_storage` in your Dart code:
Expand Down
112 changes: 48 additions & 64 deletions packages/flutter_secure_storage/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ class HomePage extends StatefulWidget {
class HomePageState extends State<HomePage> {
late FlutterSecureStorage _storage;

final TextEditingController _accountNameController =
TextEditingController(text: AppleOptions.defaultAccountName);
final TextEditingController _accountNameController = TextEditingController(
text: AppleOptions.defaultAccountName,
);

final List<_SecItem> _items = [];
String _errorMessage = '';
Expand Down Expand Up @@ -92,8 +93,9 @@ class HomePageState extends State<HomePage> {
..clear()
..addAll(all.entries.map((e) => _SecItem(e.key, e.value)))
..sort(
(a, b) => (int.tryParse(a.key) ?? 10)
.compareTo(int.tryParse(b.key) ?? 11),
(a, b) => (int.tryParse(a.key) ?? 10).compareTo(
int.tryParse(b.key) ?? 11,
),
);
});
} on PlatformException catch (e) {
Expand Down Expand Up @@ -146,16 +148,20 @@ class HomePageState extends State<HomePage> {
if (technicalDetails.contains('BIOMETRIC_UNAVAILABLE')) {
// Parse specific biometric error
if (technicalDetails.contains('No biometric hardware')) {
userMessage = 'Your device does not have biometric hardware '
userMessage =
'Your device does not have biometric hardware '
'(fingerprint or face scanner).';
} else if (technicalDetails.contains('No fingerprint or face enrolled')) {
userMessage = 'No biometric enrolled. Please add a fingerprint or '
userMessage =
'No biometric enrolled. Please add a fingerprint or '
'face in your device Settings.';
} else if (technicalDetails.contains('no PIN, pattern, password')) {
userMessage = 'No device security set up. Please set a PIN, '
userMessage =
'No device security set up. Please set a PIN, '
'pattern, or password in Settings → Security.';
} else if (technicalDetails.contains('Android 9')) {
userMessage = 'Biometric authentication requires Android 9 or '
userMessage =
'Biometric authentication requires Android 9 or '
'higher. Your device is not supported.';
} else if (technicalDetails.contains('temporarily unavailable')) {
userMessage =
Expand Down Expand Up @@ -311,49 +317,34 @@ class HomePageState extends State<HomePage> {
_performAction(action, _items[index], context),
itemBuilder: (BuildContext context) =>
<PopupMenuEntry<_ItemActions>>[
PopupMenuItem(
value: _ItemActions.delete,
child: Text(
'Delete',
key: Key('delete_row_$index'),
),
),
PopupMenuItem(
value: _ItemActions.edit,
child: Text(
'Edit',
key: Key('edit_row_$index'),
),
),
PopupMenuItem(
value: _ItemActions.containsKey,
child: Text(
'Contains Key',
key: Key('contains_row_$index'),
),
),
PopupMenuItem(
value: _ItemActions.read,
child: Text(
'Read',
key: Key('read_row_$index'),
),
),
],
PopupMenuItem(
value: _ItemActions.delete,
child: Text('Delete', key: Key('delete_row_$index')),
),
PopupMenuItem(
value: _ItemActions.edit,
child: Text('Edit', key: Key('edit_row_$index')),
),
PopupMenuItem(
value: _ItemActions.containsKey,
child: Text(
'Contains Key',
key: Key('contains_row_$index'),
),
),
PopupMenuItem(
value: _ItemActions.read,
child: Text('Read', key: Key('read_row_$index')),
),
],
),
leading: const Column(
mainAxisAlignment: MainAxisAlignment.spaceEvenly,
crossAxisAlignment: CrossAxisAlignment.start,
children: [Text('Value'), Text('Key')],
),
title: Text(
_items[index].value,
key: Key('value_row_$index'),
),
subtitle: Text(
_items[index].key,
key: Key('key_row_$index'),
),
title: Text(_items[index].value, key: Key('value_row_$index')),
subtitle: Text(_items[index].key, key: Key('key_row_$index')),
),
),
),
Expand All @@ -370,9 +361,7 @@ class HomePageState extends State<HomePage> {
try {
switch (action) {
case _ItemActions.delete:
await _storage.delete(
key: item.key,
);
await _storage.delete(key: item.key);
await _readAll();
case _ItemActions.edit:
if (!context.mounted) return;
Expand All @@ -381,10 +370,7 @@ class HomePageState extends State<HomePage> {
builder: (_) => _EditItemWidget(item.value),
);
if (result != null) {
await _storage.write(
key: item.key,
value: result,
);
await _storage.write(key: item.key, value: result);
await _readAll();
}
case _ItemActions.containsKey:
Expand All @@ -401,11 +387,9 @@ class HomePageState extends State<HomePage> {
final key = await _displayTextInputDialog(context, item.key);
final result = await _storage.read(key: key);
if (!context.mounted) return;
ScaffoldMessenger.of(context).showSnackBar(
SnackBar(
content: Text('value: $result'),
),
);
ScaffoldMessenger.of(
context,
).showSnackBar(SnackBar(content: Text('value: $result')));
}
} on PlatformException catch (e) {
_handleInitializationError(e);
Expand All @@ -427,27 +411,27 @@ class HomePageState extends State<HomePage> {
child: const Text('OK'),
),
],
content: TextField(
controller: controller,
key: const Key('key_field'),
),
content: TextField(controller: controller, key: const Key('key_field')),
),
);
return controller.text;
}

String _randomValue() {
final rand = Random();
final codeUnits =
List<int>.generate(20, (_) => rand.nextInt(26) + 65, growable: false);
final codeUnits = List<int>.generate(
20,
(_) => rand.nextInt(26) + 65,
growable: false,
);

return String.fromCharCodes(codeUnits);
}
}

class _EditItemWidget extends StatelessWidget {
_EditItemWidget(String text)
: _controller = TextEditingController(text: text);
: _controller = TextEditingController(text: text);

final TextEditingController _controller;

Expand Down
6 changes: 3 additions & 3 deletions packages/flutter_secure_storage/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@ description: Demonstrates how to use the flutter_secure_storage_tizen plugin.
publish_to: "none"

environment:
sdk: ^3.6.0
flutter: ">=3.27.0"
sdk: ^3.8.0
flutter: ">=3.32.0"

dependencies:
flutter:
sdk: flutter
flutter_secure_storage: ^10.0.0
flutter_secure_storage: ^11.0.0
flutter_secure_storage_tizen:
path: ../

Expand Down
8 changes: 4 additions & 4 deletions packages/flutter_secure_storage/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@ name: flutter_secure_storage_tizen
description: Tizen implementation of the flutter_secure_storage plugin.
homepage: https://github.com/flutter-tizen/plugins
repository: https://github.com/flutter-tizen/plugins/tree/main/packages/flutter_secure_storage
version: 0.1.5
version: 0.1.6

environment:
sdk: ^3.6.0
flutter: ">=3.27.0"
sdk: ^3.8.0
flutter: ">=3.32.0"

flutter:
plugin:
Expand All @@ -19,7 +19,7 @@ flutter:
dependencies:
flutter:
sdk: flutter
flutter_secure_storage_platform_interface: ^2.0.0
flutter_secure_storage_platform_interface: ^2.0.3

dev_dependencies:
flutter_test:
Expand Down
Loading