sendImageMessage method
Implementation
Future<void> sendImageMessage(String path, {String? name}) async {
if (path.isEmpty) {
return;
}
File file = File(path);
Image.file(file).image.resolve(const ImageConfiguration()).addListener(
ImageStreamListener(
(info, synchronousCall) {
Message message = Message.createImageSendMessage(
targetId: profile.id,
chatType: chatType,
filePath: path,
width: info.image.width.toDouble(),
height: info.image.height.toDouble(),
fileSize: file.lengthSync(),
displayName: name,
);
sendMessage(message);
},
),
);
}