sendToDevicesOfUserIds method

Future<void> sendToDevicesOfUserIds(
  1. Set<String> users,
  2. String eventType,
  3. Map<String, dynamic> message, {
  4. String? messageId,
})

Send an (unencrypted) to device message of a specific eventType to all devices of a set of users.

Implementation

Future<void> sendToDevicesOfUserIds(
  Set<String> users,
  String eventType,
  Map<String, dynamic> message, {
  String? messageId,
}) async {
  // Send with send-to-device messaging
  final data = <String, Map<String, Map<String, dynamic>>>{};
  for (final user in users) {
    data[user] = {'*': message};
  }
  await sendToDevice(
      eventType, messageId ?? generateUniqueTransactionId(), data);
  return;
}