crash_forensics 1.0.0 copy "crash_forensics: ^1.0.0" to clipboard
crash_forensics: ^1.0.0 copied to clipboard

Crash Forensics is a lightweight Flutter/Dart crash reporter that captures stack traces, logs, variables, device info, and user actions at the moment of a crash, saving everything locally as a structu [...]

example/lib/main.dart

// example/lib/main.dart
//
// Complete example demonstrating crash_forensics in a real Flutter app.
// ─────────────────────────────────────────────────────────────────────────────

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

import 'screens/home_screen.dart';
import 'screens/crash_list_screen.dart';

void main() {
  ForensicsInitializer.run(
    config: ForensicsConfig.production(
      appName: 'CrashForensics Demo',
      appVersion: '1.0.0',
      reporters: [
        // Uncomment to also print to console in release:
        // ConsoleReporter(verbose: true),
      ],
    ),
    onReady: () async {
      // Mark initial variables for observation
      CrashForensics.watch('userId', null);
      CrashForensics.watch('isLoggedIn', false);
      CrashForensics.watch('currentRoute', '/home');
      CrashForensics.log('App initialised', tag: 'MAIN', level: LogLevel.info);
    },
    appRunner: () async => runApp(const CrashForensicsDemoApp()),
  );
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'CrashForensics Demo',
      debugShowCheckedModeBanner: false,

      // 🔑 Register navigator observer for auto navigation breadcrumbs
      navigatorObservers: [ForensicNavigatorObserver()],

      theme: ThemeData(
        useMaterial3: true,
        colorScheme: ColorScheme.fromSeed(
          seedColor: const Color(0xFF1565C0),
          brightness: Brightness.light,
        ),
      ),
      darkTheme: ThemeData(
        useMaterial3: true,
        colorScheme: ColorScheme.fromSeed(
          seedColor: const Color(0xFF1565C0),
          brightness: Brightness.dark,
        ),
      ),

      routes: {
        '/': (_) => const HomeScreen(),
        '/reports': (_) => const CrashListScreen(),
      },
      initialRoute: '/',
    );
  }
}
0
likes
120
points
28
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Crash Forensics is a lightweight Flutter/Dart crash reporter that captures stack traces, logs, variables, device info, and user actions at the moment of a crash, saving everything locally as a structured JSON report. Works offline, privacy-first, and requires no servers or subscriptions.

Repository (GitHub)
View/report issues

Topics

#crash-reporting #debugging #error-handling #forensics #logging

License

MIT (license)

Dependencies

archive, battery_plus, connectivity_plus, device_info_plus, flutter, http, json_annotation, package_info_plus, path_provider, uuid

More

Packages that depend on crash_forensics