/ SDKs / Flutter
SDKs
Chat SDKs Flutter v4
Chat SDKs Flutter
Chat SDKs
Flutter
Version 4

Mark messages as delivered

Copy link

Delivery receipt can be used to see whether a message has been successfully delivered to all the intended recipients by the Sendbird server. To mark a message as delivered when an offline group channel member receives a push notification for the message from Firebase Cloud Messaging, use the markAsDelivered() method.

// App is in the foreground.
FirebaseMessaging.onMessage.listen((RemoteMessage remoteMessage) {
  // ...
  SendbirdChat.markAsDelivered(remoteMessage.data);
});

// App is in the background.
FirebaseMessaging.onBackgroundMessage(_backgroundMessageHandler);

@pragma('vm:entry-point')
Future<void> _backgroundMessageHandler(RemoteMessage remoteMessage) async {
  // ...
  SendbirdChat.markAsDelivered(remoteMessage.data);
}

When a message is delivered to a group channel member who is online, the message is marked as delivered and other members who are online are notified of the delivery receipt through the onDeliveryStatusUpdated() method of the channel event handler.

class MyGroupChannelHandler extends GroupChannelHandler {
  @override
  void onDeliveryStatusUpdated(GroupChannel channel) {
    // Delivery status is updated.
  }
}