Skip to content

Commit

Permalink
null-safety
Browse files Browse the repository at this point in the history
  • Loading branch information
丁祖华 authored and 丁祖华 committed Sep 10, 2021
1 parent 9f1de68 commit 5af982b
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions lib/flutter_aes_ecb_pkcs5.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,18 @@ class FlutterAesEcbPkcs5 {
///
/// * If it is a Android device, like 'Android 9.0'.
/// * If it is a IOS device, like 'IOS 11.2'.
static Future<String?> get platformVersion async {
final String? version = await _channel.invokeMethod('getPlatformVersion');
static Future<String> get platformVersion async {
final String version = await _channel.invokeMethod('getPlatformVersion');
return version;
}

/// Used to generate a specific length of AES key with the given [length].
///
/// If it is a 128-bit key, enter 128 and the returned key will be encoded by Hex.
/// [value] and [key] shoudn't be null.
static Future<String?> generateDesKey(int length) async {
static Future<String> generateDesKey(int length) async {
try {
final String? result =
final String result =
await _channel.invokeMethod('generateDesKey', {"length": length});
return result;
} on PlatformException catch (e) {
Expand All @@ -34,7 +34,7 @@ class FlutterAesEcbPkcs5 {
///
/// The result of the encryption will be encoded by HEX.
/// [txt] and [key] shoudn't be null.
static Future<String?> encryptString(String txt, String key) async {
static Future<String> encryptString(String txt, String key) async {
try {
final String result =
await _channel.invokeMethod('encrypt', {"input": txt, "key": key});
Expand All @@ -48,7 +48,7 @@ class FlutterAesEcbPkcs5 {
///
/// The content [txt] that needs to be decrypted must be HEX encoded,key also.
/// [txt] and [key] shoudn't be null.
static Future<String?> decryptString(String txt, String key) async {
static Future<String> decryptString(String txt, String key) async {
try {
final String result =
await _channel.invokeMethod('decrypt', {"input": txt, "key": key});
Expand Down

0 comments on commit 5af982b

Please sign in to comment.