Skip to main content

crashx 0.0.1 copy "crashx: ^0.0.1" to clipboard
crashx: ^0.0.1 copied to clipboard

A new Flutter plugin for CrashX analytics.

example/lib/main.dart

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

void main() async {
  WidgetsFlutterBinding.ensureInitialized();

  // Replace with your actual API Key
  await CrashX.init(
    apiKey: "YOUR_API_KEY_HERE",
  );

  runApp(const MyApp());
}

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

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('CrashX Example'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: [
              const Text('Press the buttons to test CrashX'),
              const SizedBox(height: 20),
              ElevatedButton(
                onPressed: () {
                  // Test manual error reporting
                  try {
                    throw Exception(
                        "This is a manual test exception from CrashX Example");
                  } catch (e, stack) {
                    CrashX.recordError(e, stack);
                    ScaffoldMessenger.of(context).showSnackBar(
                      const SnackBar(content: Text('Manual error recorded')),
                    );
                  }
                },
                child: const Text('Record Manual Error'),
              ),
              const SizedBox(height: 20),
              ElevatedButton(
                onPressed: () {
                  // Test automatic uncaught error reporting
                  throw Exception(
                      "This is an uncaught test exception from CrashX Example");
                },
                child: const Text('Throw Uncaught Error'),
              ),
            ],
          ),
        ),
      ),
    );
  }
}
0
likes
140
points
51
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

A new Flutter plugin for CrashX analytics.

Repository (GitHub)
View/report issues

License

MIT (license)

Dependencies

device_info_plus, flutter, http, package_info_plus, uuid

More

Packages that depend on crashx