handle expires_in when encoded as string
diff --git a/lib/src/handle_access_token_response.dart b/lib/src/handle_access_token_response.dart
index 83d57fa..4c92810 100644
--- a/lib/src/handle_access_token_response.dart
+++ b/lib/src/handle_access_token_response.dart
@@ -71,14 +71,14 @@
if (expiresIn != null) {
if (expiresIn is String) {
try {
- expiresIn = double.tryParse(expiresIn)!.toInt();
- } catch (e) {
+ expiresIn = double.parse(expiresIn).toInt();
+ } on FormatException {
throw FormatException(
- 'parameter "expires_in" was not an int, and given string cant not be parsed to int : "$expiresIn"');
+ 'parameter "expires_in" could not be parsed as in, was: "$expiresIn"');
}
} else if (expiresIn is! int) {
throw FormatException(
- 'parameter "expires_in" was not an int, was of type ${expiresIn.runtimeType.toString()} value : "$expiresIn"');
+ 'parameter "expires_in" was not an int, was: "$expiresIn"');
}
}