| 1 | import 'dart:async'; |
| 2 | import 'dart:typed_data'; |
| 3 | import 'package:flutter/foundation.dart'; |
| 4 | import 'package:flutter/services.dart'; |
| 5 | |
| 6 | const platform = const MethodChannel('com.cakewallet.cakewallet/legacy_wallet_migration'); |
| 7 | |
| 8 | Future<String> decrypt(Uint8List bytes, {required String key, required String salt}) async => |
| 9 | (await platform.invokeMethod<String>('decrypt', {'bytes': bytes, 'key': key, 'salt': salt}))!; |
| 10 | |
| 11 | Future<dynamic> readUserDefaults(String key, {required String type}) async => |
| 12 | await platform.invokeMethod<dynamic>('read_user_defaults', {'key': key, 'type': type}); |
| 13 | |
| 14 | Future<String?> getString(String key) async => |
| 15 | await readUserDefaults(key, type: 'string') as String?; |
| 16 | |
| 17 | Future<bool?> getBool(String key) async => await readUserDefaults(key, type: 'bool') as bool?; |
| 18 | |
| 19 | Future<int?> getInt(String key) async => await readUserDefaults(key, type: 'int') as int?; |