sendChatroomFileMessage method Null safety
- {required String roomId,
- required String filePath,
- required String displayName,
- NIMNosScene nosScene = NIMNosScenes.defaultIm,
- bool resend = false,
- ChatroomMessageAction? action}
Send a file message in the chatroom.
Implementation
Future<NIMResult<NIMChatroomMessage>> sendChatroomFileMessage({
required String roomId,
required String filePath,
required String displayName,
NIMNosScene nosScene = NIMNosScenes.defaultIm,
bool resend = false,
ChatroomMessageAction? action,
}) async {
return _createMessage({
'roomId': roomId,
'filePath': filePath,
'displayName': displayName,
'nosScene': nosScene,
'messageType': 'file',
}).then((messageResult) async {
if (messageResult.isSuccess) {
final message = messageResult.data as NIMChatroomMessage;
await action?.call(message);
return sendChatroomMessage(message, resend);
} else {
return messageResult;
}
});
}