Dart / Flutter

The DNotifier Dart SDK allows developers to integrate Realtime Chat, Pub/Sub messaging, and AI features directly into Flutter mobile apps and Dart-based applications.

It provides simple APIs to connect, send messages, subscribe to channels, and interact with AI agents.


connect()

Description: Authenticates with DNotifier and connects your app to the realtime network. Sets up message callbacks for incoming messages and connection state changes.

Callbacks (optional):

  • onConnected β€” called when the client is successfully connected

  • onMessage β€” called for every incoming message

  • onDisconnected β€” called if the connection closes or encounters an error

Usage:

await client.connect();

getPlanLimits()

Description: Returns your subscription limits after authentication, including messaging, AI requests, and knowledge base usage.

Returns:

{
  messagesHardLimit,
  maxAIRequestsPerMonth,
  maxAIWordsPerMonth,
  knowledgeBaseMaxWords,
  aiEnabled,
  maxUsers,
  maxRowsPerUser
}

Usage:


send({ senderId, receiverId, receiverIds, data })

Description: Send a realtime text message to one or multiple recipients.

Parameters:

  • senderId β€” required

  • receiverId β€” single recipient (optional if receiverIds is provided)

  • receiverIds β€” array of recipients (optional if receiverId is provided)

  • data β€” message payload

Usage:


sendAI({ senderId, message })

Description: Send a message to the AI pipeline. Responses are returned via the onMessage callback.

Parameters:

  • senderId β€” required

  • message β€” object

Usage:


fetchAIHistory({ senderId })

Description: Fetch previous AI messages sent by a user.

Parameters:

  • senderId β€” required

Usage:


sendBinary({ senderId, receiverIds, buffer, type })

Description: Send binary data (images, audio, files) to one or multiple recipients.

Parameters:

  • senderId β€” required

  • receiverIds β€” array of recipients

  • buffer β€” binary data (required)

  • type β€” optional, default "binary"

Usage:


Deprecated: sendWithOpenAI({ senderId, message })

Description: Deprecated: Use sendAI() instead. Maintains compatibility with older code.

Full Workflow Example (Safe Post-Connection)

Last updated