Browse documentation

Instrument

Flutter

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

teml_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:
  teml_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:teml_flutter/teml_flutter.dart';

Future<void> main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Teml.configure(
    const TemlOptions(
      apiKey: 'tm_...',
      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 Teml.identify('user_8842', set: {'plan': 'pro'});
await Teml.group('company', 'acme', set: {'plan': 'enterprise'});
await Teml.capture('checkout_completed', properties: {'total': 42});
await Teml.screen('Checkout');

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

Errors and crashes

Teml.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 Teml.captureError(
    error,
    stack,
    options: const CaptureOptions(tags: {'screen': 'cart'}),
  );
}

Native crashes use the underlying iOS and Android handlers. Upload their dSYM or ProGuard mapping. Teml 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 Teml.propagationHeaders() returns W3C trace and customer baggage for trusted backend calls. Call await Teml.flush() before a test assertion and await Teml.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.