updateFcmToken method
Future<void>
updateFcmToken(
- String firebasetoken,
- bool isForceUpdate,
- dynamic callback(
- FlyResponse response
override
This method is used to update the FCM Token to the MirrorFly server.
Implementation
@override
Future<void> updateFcmToken(String firebasetoken, bool isForceUpdate,
Function(FlyResponse response)? callback) async {
// bool? res;
try {
final String? res = await mirrorFlyMethodChannel.invokeMethod<String>(
'updateFcmToken',
{"token": firebasetoken, "isForceUpdate": isForceUpdate});
LogMessage.d("updateFcmToken", " $res");
callback?.call(FlyResponse(true, convertTokenResponseToJson(res),
"fcm token updated successfully"));
// return res;
} on PlatformException catch (e) {
LogMessage.d("Platform Exception =", " $e");
callback?.call(FlyResponse(false, convertTokenResponseToJson(e.message),
FlyConstants.empty, FlyException(e.code, e.message, e.details)));
// rethrow;
} on Exception catch (e) {
LogMessage.d("Exception ", " $e");
callback?.call(FlyResponse(false, FlyConstants.empty, FlyConstants.empty,
FlyException(FlyErrorCode.unHandle, FlyErrorMessage.unHandle, e)));
// rethrow;
}
}