Browse documentation

Instrument

Flutter

Connect Dart and native mobile failures to one Flutter customer journey.

anectico_flutter bridges Dart to the native iOS and Android SDKs. Identity, sessions, persistence, transport, and native crash handling remain in the native runtimes; the plugin adds Dart error capture.

Add and configure the plugin

After the registry release:

dependencies:
  anectico_flutter: ^0.1.0

During early access, use the Git source path or package artifact supplied during onboarding. For iOS, enable Flutter’s Swift Package Manager integration once with flutter config --enable-swift-package-manager. The iOS deployment target is 15 or later.

import 'package:anectico_flutter/anectico_flutter.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Anectico.configure(
    const AnecticoOptions(
      apiKey: 'an_...',
      environment: 'production',
      serviceVersion: '1.4.0',
    ),
  );
  runApp(const MyApp());
}

Use a project-scoped key with ingest:write and analytics:write. Do not include read, management, or agent scopes in the application.

Connect identity and events

await Anectico.identify('user_8842', set: {'plan': 'pro'});
await Anectico.group('company', 'acme', set: {'plan': 'enterprise'});
await Anectico.capture('checkout_completed', properties: {'total': 42});
await Anectico.screen('Checkout');

// On logout:
await Anectico.reset();

reset also clears global error-user context and buffered breadcrumbs, preventing the prior account’s diagnostic context from attaching to the next account on a shared device.

Errors and crashes

Anectico.configure installs handlers for Flutter framework errors and uncaught asynchronous Dart errors unless enableDartErrorCapture is false. Existing handlers remain chained.

try {
  await checkout();
} catch (error, stack) {
  await Anectico.captureError(
    error,
    stack,
    options: const CaptureOptions(tags: {'screen': 'cart'}),
  );
}

Native crashes use the underlying iOS and Android handlers. Upload their dSYM or ProGuard mapping. Issue details identify Dart failures as anectico-flutter / dart and preserve their already-symbolic package: frames without native artifact guidance. A Java/Kotlin, Swift, Objective-C, or signal crash from the same Flutter application remains a native occurrence and still receives the relevant ProGuard or dSYM status.

Each occurrence also inherits SDK-owned app/build, OS, and privacy-safe hardware-model context from the native transport. Anectico never collects a stable device identifier or user-assigned device name.

Anectico does not currently symbolicate obfuscated Dart frames produced by --obfuscate; keep debug information and use flutter symbolize out of band when that build mode is required.

Propagate and shut down

await Anectico.propagationHeaders() returns W3C trace and customer baggage for trusted backend calls. Call await Anectico.flush() before a test assertion and await Anectico.shutdown() when releasing the runtime.

Verify

Identify a test customer, capture a Dart error and event, and confirm both appear together. If iOS fails to link the native package, confirm Swift Package Manager support is enabled and rebuild the application rather than hot reloading.