dashi_flutter 1.0.1 copy "dashi_flutter: ^1.0.1" to clipboard
dashi_flutter: ^1.0.1 copied to clipboard

Flutter bindings for the dashi Umami Analytics client — navigator observer, device context provider, and lifecycle-aware queue flushing.

example/main.dart

// A minimal Flutter example of dashi_flutter.
//
// Point `endpoint`/`websiteId` at your own Umami instance (>= 3.1.0).
// A fuller demo lives in the repository's top-level `example/` app.
import 'package:dashi/dashi.dart';
import 'package:dashi_flutter/dashi_flutter.dart';
import 'package:flutter/material.dart';

final umami = UmamiClient(
  endpoint: Uri.parse('https://umami.example.com'),
  websiteId: 'xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx',
  hostname: 'com.example.app',
  contextProvider:
      flutterContextProvider(appName: 'MyApp', appVersion: '1.0.0'),
);

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  attachLifecycleFlush(umami); // flush the offline queue on paused/detached
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      // Every navigation is automatically tracked as a pageview.
      navigatorObservers: [DashiNavigatorObserver(client: umami)],
      home: Scaffold(
        appBar: AppBar(title: const Text('dashi example')),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            spacing: 12,
            children: [
              ElevatedButton(
                onPressed: () => umami.event('cta_click', url: '/'),
                child: const Text('Track a custom event'),
              ),
              ElevatedButton(
                onPressed: () => umami.identify('demo-user-42'),
                child: const Text('Identify the user'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
160
points
109
downloads

Documentation

API reference

Publisher

verified publisherowlnext.fr

Weekly Downloads

Flutter bindings for the dashi Umami Analytics client — navigator observer, device context provider, and lifecycle-aware queue flushing.

Repository (GitHub)
View/report issues

Topics

#analytics #umami #tracking #telemetry

License

MIT (license)

Dependencies

dashi, flutter

More

Packages that depend on dashi_flutter