updateFcmToken method

  1. @override
Future<void> updateFcmToken(
  1. String firebasetoken,
  2. dynamic callback(
    1. FlyResponse response
    )?
)
override

This method is used to update the FCM Token to the MirrorFly server.

Implementation

@override
Future<void> updateFcmToken(
    String firebasetoken, Function(FlyResponse response)? callback) async {
  // bool? res;
  try {
    await mirrorFlyMethodChannel
        .invokeMethod<bool>('updateFcmToken', {"token": firebasetoken});
    callback?.call(FlyResponse(
        true, FlyConstants.empty, "fcm token updated successfully"));
    // return res;
  } on PlatformException catch (e) {
    LogMessage.d("Platform Exception =", " $e");
    callback?.call(FlyResponse(false, FlyConstants.empty, 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;
  }
}