Skip to content

Commit 7fe37d2

Browse files
Merge pull request jeroentrappers#6 from flawnn/null-safety
sdk: Migrate to null-safety & uprev to minimum SDK Version 2.12
2 parents ee86aff + 0dc4f22 commit 7fe37d2

File tree

2 files changed

+12
-10
lines changed

2 files changed

+12
-10
lines changed

lib/flutter_bcrypt.dart

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import 'dart:async';
2+
13
import 'package:flutter/services.dart';
24
import 'package:flutter/foundation.dart';
35

@@ -9,25 +11,25 @@ class FlutterBcrypt {
911
/// Salt must be a string in Modular Crypt Format with $ separators
1012
/// for example r'$2b$06$C6UzMDM.H6dfI/f/IKxGhu'
1113
static Future<String> hashPw(
12-
{@required String password, @required String salt}) async =>
13-
await _channel
14-
.invokeMethod('hashPw', {'password': password, 'salt': salt});
14+
{required String password, required String salt}) async =>
15+
await (_channel
16+
.invokeMethod('hashPw', {'password': password, 'salt': salt}));
1517

1618
/// Generate a 16 byte salt with 6 rounds of cost in Modular Crypt Format.
1719
static Future<String> salt() async =>
18-
await _channel.invokeMethod('salt', {'rounds': 6});
20+
await (_channel.invokeMethod('salt', {'rounds': 6}));
1921

2022
/// Generate a salt with a given cost. Cost must be between 4 and 31.
21-
static Future<String> saltWithRounds({@required int rounds}) async =>
22-
await _channel.invokeMethod('saltWithRounds', {'rounds': rounds});
23+
static Future<String> saltWithRounds({required int rounds}) async =>
24+
await (_channel.invokeMethod('saltWithRounds', {'rounds': rounds}));
2325

2426
/// Verify if the given password matches the given hash.
2527
/// Password must be a plain UTF-8 compatible String
2628
/// Hash must be provided in Modular Crypt Format. Eg.
2729
/// $2y$06$doGnefu9cbLkJTn8sef7U.dynHJFe5hS6xp7vLWb2Zu7e8cOuMVmS
2830
/// This includes the version, complexity and 16 bytes of salt.
2931
static Future<bool> verify(
30-
{@required String password, @required String hash}) async =>
31-
await _channel
32-
.invokeMethod('verify', {'password': password, 'hash': hash});
32+
{required String password, required String hash}) async =>
33+
await (_channel
34+
.invokeMethod('verify', {'password': password, 'hash': hash}));
3335
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ author: Jeroen Trappers <jeroen@appmire.be>
55
homepage: https://github.com/jeroentrappers/flutter_bcrypt
66

77
environment:
8-
sdk: ">=2.1.0 <3.0.0"
8+
sdk: '>=2.12.0 <3.0.0'
99

1010
dependencies:
1111
flutter:

0 commit comments

Comments
 (0)