Messaging API

Flutter messaging API

A message object contains and stores all the information that can be used to send messages.

To send a message to a contact or a group, you must first create a message object:

dynamic message = {
      'to': "userId", // to send message to a contact pass the userId of the receiver (You can ignore the groupId in this case)
      'groupId': groupId, //to send message to a group pass the groupId (You can ignore the userId in this case)
      'message': "message text", // message to send



A message object can have more parameters. Refer to this link:

Then pass the message object to the sendMessage() function to send it:

    .then((value) => print("Message sent."))
    .catchError((e, s) => print("Error while sending message: " + e.toString()));

What’s Next


Did this page help you?