refreshAndGetAuthToken method
This method is used to refresh and get the AuthToken.
Implementation
@override
Future<void> refreshAndGetAuthToken(
Function(FlyResponse response)? callback) async {
String? tokenResponse;
try {
tokenResponse =
await mirrorFlyMethodChannel.invokeMethod<String>('refreshAuthToken');
LogMessage.d("refreshAuthToken Result ", " $tokenResponse");
callback?.call(FlyResponse(
true, tokenResponse ?? FlyConstants.empty, FlyConstants.empty));
// return tokenResponse;
} on PlatformException catch (e) {
LogMessage.d("Platform Exception =", " $e");
callback?.call(FlyResponse(false, FlyConstants.empty, FlyConstants.empty,
FlyException(e.code, e.message, e.details)));
} on Exception catch (e) {
LogMessage.d("Exception ", " $e");
callback?.call(FlyResponse(false, FlyConstants.empty, FlyConstants.empty,
FlyException(FlyErrorCode.unHandle, FlyErrorMessage.unHandle, e)));
}
}