Skip to content
For the complete documentation index, see llms.txt. This page is also available as Markdown.

Flutter (Android, iOS, Web)

The DNotifier Dart SDK is a pure Dart package that runs on Flutter for Android, iOS, Web, and desktop targets. No platform channels or native plugins are required in the SDK β€” WebSocket and HTTP are handled by web_socket_channel and http.

Requirements

Requirement
Version

Flutter

3.x recommended

Dart SDK

3.0 or later

DNotifier credentials

β†’ Install β€” Dart / Flutter


Add the dependency

In pubspec.yaml:

dependencies:
  flutter:
    sdk: flutter
  dnotifier: ^1.1.10
flutter pub get

Check pub.dev/packages/dnotifier for the latest version.


Platform support

Target

WebSocket (ws)

HTTP (http)

Notes

Android

βœ…

βœ…

No extra native config

iOS

βœ…

βœ…

App Transport Security allows api.dnotifier.com over TLS

Web

βœ…

βœ…

Uses browser WebSocket via package

Windows / macOS / Linux

βœ…

βœ…

Where Flutter desktop is supported

The same Dart code runs on every Flutter target. Platform differences (permissions, background execution) are handled by your app, not the SDK.


Connect in a Flutter widget

Run with compile-time defines:

β†’ Credentials & environment


State management

Wrap the DNotifier instance in your preferred pattern:

Pattern
Approach

Provider / Riverpod

Register a singleton service; expose connection state

Bloc / Cubit

Emit events from onMessage; call send from handlers

GetX

Get.put(DNotifierService()) with lifecycle hooks

Keep one connection per authenticated user session. Call disconnect() when the user logs out.


Sending messages

Multiple receivers:

β†’ Your first message β€” Dart / Flutter


AI and workflows on mobile

Use transport: 'http' for sendAI, knowledge-base APIs, and runWorkflow. Common pattern:

  • Chat UI β€” ws for realtime messages

  • AI screen or backend β€” http for prompts and RAG

You can hold two DNotifier instances with different transports, or route AI through your own API.

β†’ Choose your transport


Background and lifecycle

Event
Recommended action

AppLifecycleState.paused

Optionally disconnect to save battery

AppLifecycleState.resumed

Reconnect with backoff if disconnected

User logout

disconnect() and dispose the instance


Flutter Web specifics

  • WebSocket uses the browser's native socket β€” same behavior as the browser JavaScript guide

  • Do not embed production secrets in compiled web assets; use --dart-define only for dev or proxy through your backend

  • Test reconnection when the user switches browser tabs


Permissions

The SDK does not require microphone, camera, or notification permissions. Add those in your app only if you build voice, video, or push features on top of DNotifier messaging.


Workflows and agents

Use transport: 'http' and await notifier.runWorkflow(...).

β†’ Workflows overview


Troubleshooting

Issue
Fix

Authentication failed

Verify app ID and secret

StateError: Not connected

Await connect() before send()

Works on Android, fails on iOS

Check network / ATS; ensure TLS to api.dnotifier.com

Web build secret exposed

Move auth to backend

β†’ Troubleshooting


Next steps

Last updated