dnotifier 1.1.0 copy "dnotifier: ^1.1.0" to clipboard
dnotifier: ^1.1.0 copied to clipboard

Real-time notification and messaging SDK for Dart and Flutter. WebSocket & HTTP, auth, binary frames, and optional OpenAI integration. Supports Android, iOS, and other platforms.

DNotifier Dart SDK #

DNotifier is a real-time notification & messaging SDK for Dart and Flutter, supporting Android and iOS. It provides WebSocket and HTTP transports, binary streaming, and framed packet communication.


Features #

  • WebSocket & HTTP transport support
  • Secure authentication handshake
  • Real-time messaging (send/receive text and binary)
  • Binary data transfer (files, images, media)
  • AI pipeline: send messages to AI (sendAI), fetch AI history (fetchAIHistory)
  • Plan limits from auth (getPlanLimits)
  • Automatic packet framing & decoding
  • Handles partial packets & large payloads
  • Works on Android, iOS, and other Dart/Flutter platforms

Installation #

Add to your pubspec.yaml:

dependencies:
  dnotifier:
    path: .  # or git: https://github.com/...

Or publish the package and use:

dependencies:
  dnotifier: ^1.0.0

Then run:

dart pub get
# or
flutter pub get

Usage #

import 'package:dnotifier/dnotifier.dart';

void main() async {
  final client = DNotifier(
    appId: 'your-app-id',
    secret: 'your-app-secret',
    transport: 'ws',
    userId: 'user-123',
    onConnected: () => print('Connected'),
    onMessage: (DNotifierMessage msg) {
      print('Message from ${msg.metadata.sender}: ${msg.payload.toJSON()}');
    },
    onDisconnected: ({code, reason}) => print('Disconnected: $reason'),
  );

  await client.connect();

  // Send a text message
  client.send(
    senderId: 'user-123',
    receiverId: 'user-456',
    data: {'text': 'Hello'},
  );

  // Send binary
  client.sendBinary(
    senderId: 'user-123',
    receiverIds: ['user-456'],
    buffer: [0x00, 0x01, 0x02],
  );

  // Plan limits (after connect)
  final limits = client.getPlanLimits();
  if (limits != null && limits.aiEnabled) {
    client.sendAI(senderId: 'user-123', message: 'Hello');
    client.fetchAIHistory(senderId: 'user-123');
  }
}

API summary #

Method / property Description
DNotifier(appId, secret, transport, userId, ...) Build the client. transport is 'ws' or 'http'.
connect() Authenticate and connect (WebSocket handshake when using ws).
getPlanLimits() Plan limits from last auth (e.g. aiEnabled, maxAIRequestsPerMonth). Throws if not connected.
send(senderId, receiverId/receiverIds, data) Send a text message (JSON-serializable data).
sendAI(senderId, message) Send a message to the AI pipeline.
fetchAIHistory(senderId) Fetch AI conversation history for the sender.
sendBinary(senderId, receiverIds, buffer, type?) Send raw bytes.
sendWithOpenAI(senderId, message, ...) Deprecated: use sendAI instead. Forwards to AI pipeline.
disconnect() Close the WebSocket.
isConnected, aiEnabled Connection state and whether AI is enabled for the plan.
onConnected Callback when connection is ready.
onMessage Callback with DNotifierMessage (metadata + Payload).
onDisconnected Callback when connection closes.
Payload.raw(), .toString(), .toJSON(), .toBase64() Read received payload.
DNotifierPlanLimits Plan limits: messagesHardLimit, maxAIRequestsPerMonth, maxAIWordsPerMonth, knowledgeBaseMaxWords, aiEnabled, maxUsers, maxRowsPerUser.

0
likes
105
points
126
downloads

Publisher

unverified uploader

Weekly Downloads

Real-time notification and messaging SDK for Dart and Flutter. WebSocket & HTTP, auth, binary frames, and optional OpenAI integration. Supports Android, iOS, and other platforms.

Homepage
Repository (GitHub)

Documentation

Documentation
API reference

License

unknown (license)

Dependencies

http, uuid, web_socket_channel

More

Packages that depend on dnotifier