editTextMessage method

  1. @override
Future<void> editTextMessage({
  1. required EditMessageParams editMessageParams,
  2. required dynamic callback(
    1. FlyResponse response
    ),
})
override

This method is used to edit the text message sent previously.

Implementation

@override
Future<void> editTextMessage(
    {required EditMessageParams editMessageParams,
    required Function(FlyResponse response) callback}) async {
  LogMessage.d("editMessageParams", editMessageParams.toMap());
  String? editMessageResponse;
  try {
    editMessageResponse = await mirrorFlyMethodChannel.invokeMethod(
        'editTextMessage', editMessageParams.toMap());
    var res = convertChatMessageJsonFromString(editMessageResponse);
    callback.call(FlyResponse(true, res, "Message edited successfully"));
  } 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)));
  }
}