sendMessageByInboxId method

  1. @override
Future<Map<String, dynamic>?> sendMessageByInboxId(
  1. String recipientInboxId,
  2. dynamic message,
  3. String authorityId,
  4. String typeId,
  5. int versionMajor,
)
override

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;
}