App Inbox
App Inbox provides persistent messages inside the application. The Flutter SDK supplies the data API but no default UI, so the application controls how the inbox is displayed.
App Inbox is available in reteno_plugin 1.7.0 and later.
Get Messages
Provide both page and pageSize for pagination. If either is omitted, all messages are returned:
final allMessages = await Reteno.appInbox.getAppInboxMessages();
final firstPage = await Reteno.appInbox.getAppInboxMessages(
page: 1,
pageSize: 20,
);The result is AppInboxMessages:
class AppInboxMessages {
final List<AppInboxMessage> messages;
final int totalPages; // iOS returns 0 when the native response has no page count
}Each AppInboxMessage contains:
class AppInboxMessage {
final String id;
final String title;
final String createdDate;
final bool isNewMessage;
final String? content;
final String? imageUrl;
final String? linkUrl;
final String? category;
final Map<String?, Object?>? customData;
}createdDate is an ISO 8601 string, but iOS substitutes an empty string when the native value is absent. Check createdDate.isNotEmpty before parsing.
Get the Unread Count
Read the current count once:
final count = await Reteno.appInbox.getAppInboxMessagesCount();Or subscribe to count changes:
final subscription = Reteno.appInbox.onMessagesCountChanged.listen((count) {
print(count);
});The stream can also be used directly by a StreamBuilder<int>:
StreamBuilder<int>(
stream: Reteno.appInbox.onMessagesCountChanged,
builder: (context, snapshot) {
if (snapshot.hasData) {
return Text('${snapshot.data}');
}
return const SizedBox.shrink();
},
)Cancel direct subscriptions when the owning object is disposed. This removes the Dart listener only; the native unread-count subscription stays active for the process lifetime and cannot be cancelled from the public API.
Mark Messages as Opened
await Reteno.appInbox.markAsOpened(message.id);Mark every inbox message as opened:
await Reteno.appInbox.markAllMessagesAsOpened();From version 1.11.0, both platforms complete the Future normally on native success and with an exception on native failure. Completion means the native call finished, not that the backend has confirmed it.
