enbbox
The official Flutter/Dart SDK for Enbbox — drop-in notification inbox for your app.
Installation
dependencies:
enbbox: ^1.0.0
Or via CLI:
dart pub add enbbox
Quick Start
import 'package:enbbox/enbbox.dart';
final enbbox = Enbbox(
options: EnbboxOptions(
projectId: 'YOUR_PROJECT_ID',
subscriberId: 'USER_ID',
subscriberHash: 'HMAC_HASH', // optional, for production
),
);
// Listen for new notifications
final sub = enbbox.on<NotificationReceivedEvent>(
EnbboxEvents.notificationReceived,
(event) => print('New notification: ${event.result.body}'),
);
// Get notifications
final result = await enbbox.notifications.list();
if (result.isSuccess) {
for (final n in result.data!.notifications) {
print('${n.subject}: ${n.body}');
}
}
// Get unread count
final counts = await enbbox.notifications.count(
filters: [const NotificationFilter(read: false)],
);
// Clean up
sub.cancel();
enbbox.disconnect();
API
Enbbox(options:)
| Option | Type | Required | Description |
|---|---|---|---|
projectId |
String |
✅ | Your Enbbox project ID |
subscriberId |
String |
✅ | Unique subscriber identifier |
subscriberHash |
String |
HMAC hash for secure mode | |
apiUrl |
String |
Custom API URL | |
useCache |
bool |
Enable query cache (default: true) |
Modules
enbbox.notifications— List, read, archive, count notificationsenbbox.preferences— Manage notification channel preferencesenbbox.on<T>(event, handler)— Listen for real-time events
Notifications
// List with filters
await enbbox.notifications.list(const NotificationFilter(limit: 20));
// Mark as read / unread
await enbbox.notifications.read('notification-id');
await enbbox.notifications.unread('notification-id');
// Archive / unarchive
await enbbox.notifications.archive('notification-id');
await enbbox.notifications.unarchive('notification-id');
// Bulk operations
await enbbox.notifications.readAll();
await enbbox.notifications.archiveAll();
// Execute action
await enbbox.notifications.executeAction('notification-id', 'primary');
Preferences
// List all preferences
final prefs = await enbbox.preferences.list();
// Update global preferences
await enbbox.preferences.update(
const ChannelPreference(email: true, push: false),
);
// Update per-workflow preferences
await enbbox.preferences.updateWorkflow(
'workflow-id',
const ChannelPreference(inApp: true),
);
Events
| Event | Type | Description |
|---|---|---|
EnbboxEvents.sessionInitialized |
SessionInitializedEvent |
Session connected |
EnbboxEvents.sessionError |
SessionErrorEvent |
Session error occurred |
EnbboxEvents.notificationReceived |
NotificationReceivedEvent |
New notification received via SSE |
EnbboxEvents.unreadCountChanged |
UnreadCountChangedEvent |
Unread count updated |
EnbboxEvents.listUpdated |
ListUpdatedEvent |
Notification list refreshed |
License
MIT
Libraries
- enbbox
- Enbbox Flutter SDK — drop-in notification inbox for your Flutter app.