Dart / Flutter
Package: dnotifier
Setup
import 'package:dnotifier/dnotifier.dart';
final notifier = DNotifier(
appId: Platform.environment['DNOTIFIER_APP_ID']!,
secret: Platform.environment['DNOTIFIER_SECRET']!,
transport: 'http',
userId: 'user-123',
permissionEnforcement: 'backend', // or 'disabled'
onAgentEvent: (event) {
print('${event['type']} ${event['toolId']}');
},
);
await notifier.connect();Register a local tool
final add = notifier.tools.register(
name: 'math.add',
description: 'Add two numbers',
inputSchema: {
'type': 'object',
'properties': {
'a': {'type': 'number'},
'b': {'type': 'number'},
},
'required': ['a', 'b'],
},
execute: (input, context) async {
final a = (input['a'] as num).toDouble();
final b = (input['b'] as num).toDouble();
return {'sum': a + b};
},
);Connect MCP
Define a tool agent
Omit run: when tools is set — the SDK runs the tool agent for you. Existing defineAgent(name: ..., run: ...) call sites stay valid.
Run standalone
Inside a workflow
Errors
Typed errors include ToolNotFoundError, ToolValidationError, PermissionDeniedError, MCPConnectionError, MCPToolError, LLMError, and AgentExecutionError (exported from package:dnotifier/dnotifier.dart).
Learn more
Last updated