sendMessageByInboxId method
Returns a map with messageId and the live DM topic (the conversation
that was actually sent to — send is find-or-create, so this is always the
canonical DM topic). topic may be null on platforms that don't surface it.
Implementation
@override
Future<Map<String, dynamic>?> sendMessageByInboxId(String recipientInboxId, dynamic message, String authorityId, String typeId, int versionMajor) async {
if (message is! Map<String, dynamic>) {
throw const FormatException('Message must be a Map with content and parameters');
}
final result = await methodChannel.invokeMethod('sendMessageByInboxId', {
'recipientInboxId': recipientInboxId,
'message': message,
'authorityId': authorityId,
'typeId': typeId,
'versionMajor': versionMajor,
});
// New native impl returns {messageId, topic}; tolerate the legacy
// String (messageId only) return shape for forward/backward safety.
if (result is Map) {
return Map<String, dynamic>.from(result);
}
if (result is String) {
return {'messageId': result, 'topic': null};
}
return null;
}