loadMessages method
This method is used to load the messages.
Implementation
@override
Future<void> loadMessages(Function(FlyResponse response)? callback) async {
String? initialMessageResponse;
try {
initialMessageResponse =
await mirrorFlyMethodChannel.invokeMethod('loadMessages');
var res = convertChatMessagesJsonFromString(initialMessageResponse);
callback?.call(FlyResponse(true, res, "load message fetched"));
} 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)));
}
}