Skip to content

Commit 744d083

Browse files
committed
Better use of async/await concepts
Signed-off-by: Simone Arpe <[email protected]>
1 parent 727cd1a commit 744d083

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

lib/pspdfkit.dart

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Pspdfkit {
2121

2222
/// Gets the PSPDFKit framework version.
2323
static Future<String> get frameworkVersion async =>
24-
await _channel.invokeMethod('frameworkVersion');
24+
_channel.invokeMethod('frameworkVersion');
2525

2626
/// Sets the license key.
2727
static Future<void> setLicenseKey(String licenseKey) async =>
@@ -36,11 +36,11 @@ class Pspdfkit {
3636
}
3737

3838
/// Sets the value of a form field by specifying its fully qualified field name.
39-
static Future<bool> setFormFieldValue(String value, String fullyQualifiedName) =>
39+
static Future<bool> setFormFieldValue(String value, String fullyQualifiedName) async =>
4040
_channel.invokeMethod('setFormFieldValue', <String, dynamic>{'value': value, 'fullyQualifiedName': fullyQualifiedName});
4141

4242
/// Gets the form field value by specifying its fully qualified name.
43-
static Future<String> getFormFieldValue(String fullyQualifiedName) =>
43+
static Future<String> getFormFieldValue(String fullyQualifiedName) async =>
4444
_channel.invokeMethod('getFormFieldValue', <String, dynamic>{'fullyQualifiedName': fullyQualifiedName});
4545

4646
/// Applies Instant document JSON to the presented document.
@@ -52,15 +52,14 @@ class Pspdfkit {
5252

5353
/// Saves the document back to its original location if it has been changed.
5454
/// If there were no changes to the document, the document file will not be modified.
55-
static Future<bool> save() => _channel.invokeMethod('save');
55+
static Future<bool> save() async => _channel.invokeMethod('save');
5656

5757
/// Checks the external storage permission for writing on Android only.
5858
static Future<bool> checkAndroidWriteExternalStoragePermission() async {
59-
final bool isGranted = await _channel.invokeMethod(
59+
_channel.invokeMethod(
6060
"checkPermission",
6161
{"permission": "WRITE_EXTERNAL_STORAGE"}
6262
);
63-
return isGranted;
6463
}
6564

6665
/// Requests the external storage permission for writing on Android only.
@@ -77,7 +76,7 @@ class Pspdfkit {
7776

7877
/// Opens the Android settings.
7978
static Future<void> openAndroidSettings() async {
80-
await _channel.invokeMethod("openSettings");
79+
_channel.invokeMethod("openSettings");
8180
}
8281

8382
static AndroidPermissionStatus _intToAndroidPermissionStatus(int status) {

0 commit comments

Comments
 (0)