ADK Notifier

A Flutter package for integrating with the ART Real-time Notification Service. This package provides tools for notification history management, live WebSocket updates, and push device registration.

Features

  • Notification History: List all notifications for a tenant.
  • Real-time Events: Listen for new notifications via WebSocket subscriptions.
  • Unread Management: Track unread counts and mark notifications as read.
  • Push Registration: Register and unregister device tokens for push notifications (e.g., FCM).
  • Notification Sending: Send targeted notifications to specific recipients.

Getting started

Add adk_notifier to your pubspec.yaml along with the core art_adk package:

dependencies:
  art_adk: ^1.0.4
  adk_notifier: ^0.0.1

Usage

Initialize the API

The NotificationsApi is initialized from an existing Adk instance:

import 'package:art_adk/art_adk.dart';
import 'package:adk_notifier/adk_notifier.dart';

final adk = Adk(adkConfig: ...);
final notificationsApi = NotificationsApi.fromAdk(adk);

Listen for Real-time Notifications

final removeListener = await notificationsApi.onNew((notification) {
  print('New notification: ${notification.title}');
});

// To stop listening later:
// await removeListener();

Load History and Mark Read

// Fetch notifications
final result = await notificationsApi.list();
print('Total notifications: ${result.total}');

// Mark specific notifications as read
await notificationsApi.markRead(['notif_id_1', 'notif_id_2']);

// Mark all as read
await notificationsApi.markRead();

Register Device for Push

await notificationsApi.registerDevice(
  RegisterDeviceInput(
    token: 'FCM_TOKEN',
    platform: 'android',
  ),
);

Send a Notification

await notificationsApi.send(
  SendInput(
    recipients: ['user_123'],
    type: 'alert',
    title: 'Hello',
    body: 'This is a test notification',
    channels: ['in_app', 'push'],
  ),
);

Additional information

For more documentation on the underlying ART platform, visit docs.arealtimetech.com.

Libraries

adk_notifier