dazzle_flutter 1.0.0-beta.6 copy "dazzle_flutter: ^1.0.0-beta.6" to clipboard
dazzle_flutter: ^1.0.0-beta.6 copied to clipboard

Dazzle SDK for Flutter. Embedded in-process database with HNSW vector search and a ChatAgent runtime for on-device LLM agents. Links the same libdazzle.so / Dazzle.xcframework the native Android and i [...]

example/lib/main.dart

// Copyright 2026 Ivan Aliaga <ivan.aliaga@urp.edu.pe>
// SPDX-License-Identifier: Apache-2.0
//
// Smoke-test app for dazzle_flutter. Boots Dazzle, round-trips a hash,
// times the RESP-free `getAllDirect` path, and prints each result on
// screen. Ship-shape to prove the full FFI + method-channel pipeline.

import 'package:flutter/material.dart';
import 'package:dazzle_flutter/dazzle_flutter.dart';

void main() {
  runApp(const _App());
}

class _App extends StatelessWidget {
  const _App();
  @override
  Widget build(BuildContext context) =>
      const MaterialApp(home: _Home(), title: 'dazzle_flutter smoke');
}

class _Home extends StatefulWidget {
  const _Home();
  @override
  State<_Home> createState() => _HomeState();
}

class _HomeState extends State<_Home> {
  String _log = 'booting Dazzle…';

  @override
  void initState() {
    super.initState();
    _run();
  }

  Future<void> _run() async {
    try {
      final sw = Stopwatch()..start();

      await DazzleServer.shared.start(
          config: const DazzleConfig(maxMemory: '32mb'));
      final bootMs = sw.elapsedMilliseconds;

      final dazzle = DazzleServer.shared.client();
      final hash = dazzle.hash('demo:turn:1');

      sw.reset();
      hash.setAll({'role': 'user', 'text': "What's the weather in Lima?"});
      final writeUs = sw.elapsedMicroseconds;

      sw.reset();
      final turn = hash.getAllDirect();
      final directUs = sw.elapsedMicroseconds;

      sw.reset();
      final turnResp = hash.getAll();
      final respUs = sw.elapsedMicroseconds;

      hash.deleteKey();

      setState(() {
        _log = [
          'boot               : ${bootMs}ms',
          'HSET x2            : ${writeUs}µs',
          'getAllDirect       : ${directUs}µs',
          'getAll (RESP)      : ${respUs}µs',
          '',
          'read-back:  $turn',
          'read-back (RESP):  $turnResp',
        ].join('\n');
      });
    } catch (e, st) {
      setState(() => _log = 'ERROR: $e\n$st');
    }
  }

  @override
  Widget build(BuildContext context) => Scaffold(
        appBar: AppBar(title: const Text('dazzle_flutter smoke')),
        body: Padding(
          padding: const EdgeInsets.all(16),
          child: SingleChildScrollView(
            child: SelectableText(
              _log,
              style: const TextStyle(fontFamily: 'Courier', fontSize: 13),
            ),
          ),
        ),
      );
}
0
likes
130
points
246
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Dazzle SDK for Flutter. Embedded in-process database with HNSW vector search and a ChatAgent runtime for on-device LLM agents. Links the same libdazzle.so / Dazzle.xcframework the native Android and iOS SDKs ship — zero behaviour drift across platforms. Includes five swappable LLMClient adapters: LlamaCpp (GGUF), LiteRT-LM, FoundationModels (iOS 26+), OpenAI-compatible, and Anthropic.

Repository (GitHub)
View/report issues

Topics

#llm #agent #embedded-database #vector-search #on-device-ai

License

Apache-2.0 (license)

Dependencies

ffi, flutter, flutter_web_plugins, http, plugin_platform_interface, web

More

Packages that depend on dazzle_flutter

Packages that implement dazzle_flutter