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

Pure Dart

The DNotifier Dart SDK is pure Dart β€” no Flutter dependency. Use it in CLI tools, Dart servers, scripts, and any Dart 3 project that needs realtime messaging, AI, or workflows without a UI framework.

Requirements

Requirement
Version

Dart SDK

3.0 or later

DNotifier credentials

β†’ Install β€” Dart / Flutter (same package, skip Flutter steps)


Create a Dart project

dart create my_dnotifier_service
cd my_dnotifier_service

Add to pubspec.yaml:

name: my_dnotifier_service
environment:
  sdk: ">=3.0.0 <4.0.0"

dependencies:
  dnotifier: ^1.1.10
dart pub get

WebSocket server or worker

Pure Dart on Linux, macOS, or Windows can hold persistent WebSocket connections β€” ideal for relay services, bots, and background workers.

Run with defines:

Unlike Node.js, Dart does not require a separate WebSocket package. The SDK uses web_socket_channel internally.


HTTP transport for APIs and scripts

One-shot scripts and REST-style services use HTTP:

β†’ Choose your transport


Environment configuration

Compile-time defines

Runtime environment variables

For server deployments, read from Platform.environment:

Never commit secrets. Use your host's secret manager in production.

β†’ Credentials & environment


Knowledge base batch jobs

Index documents from the filesystem or a database:

Use transport: 'http' and respect plan word limits.

β†’ Manage documents


Workflows in Dart

β†’ Run a workflow


Concurrency

DNotifier is not isolate-safe. Use one instance per isolate:

Pattern
Guidance

Single worker

One DNotifier, one event loop

Multiple workers

One isolate per worker, each with its own userId

Isolate.spawn

Pass messages between isolates; do not share the client


Logging and observability

Enable SDK session logging for AI dashboard telemetry:

Workflow observability is enabled per workflow with observability: true.

β†’ Session logging Β· Workflow observability


Deployment targets

Target
Notes

VM (dart run / compiled exe)

Full WebSocket and HTTP support

Docker

Long-running ws services work well

Cloud Run / serverless

Prefer http for short-lived invocations


Pure Dart vs Flutter

Feature
Pure Dart
Flutter

Package

dnotifier

Same dnotifier package

WebSocket

βœ…

βœ…

UI lifecycle

Manual (signals, process exit)

dispose(), AppLifecycleState

Web target

Dart web compiler

Flutter Web

If you add a UI later, the same SDK calls transfer to Flutter with minimal changes.

β†’ Flutter platform guide


Next steps

Last updated