outcode_bug_reporter 2.1.1
outcode_bug_reporter: ^2.1.1 copied to clipboard
In-app bug reporter for Flutter: a floating button that captures the screen, lets users annotate and redact it, set a severity, and file it to ClickUp or any backend.
example/lib/main.dart
// Minimal integration example.
//
// The point of interest is `MaterialApp.builder`: mounting BugReporter there puts
// it above the Navigator, so the button floats over every route (dialogs and
// bottom sheets included) and only `child` ends up inside the capture boundary.
//
// A fuller demo — themes, dialogs, redaction, breadcrumbs, a failing request —
// lives in `example-flutter/` at the repository root.
import 'package:flutter/material.dart';
import 'package:outcode_bug_reporter/outcode_bug_reporter.dart';
void main() => runApp(const MyApp());
class MyApp extends StatelessWidget {
const MyApp({super.key});
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Bug Reporter example',
// Optional: fills the "Route" row in the captured context.
navigatorObservers: [BugReporterNavigatorObserver()],
home: const HomePage(),
builder: (context, child) => BugReporter(
config: BugReporterConfig(
appName: 'My App',
appVersion: '1.0.0',
theme: BugReporterTheme.indigo,
// Swap for OutcodeBackendBugReporterRepository(endpoint:, apiKey:,
// targetKey:) — recommended, keeps the ClickUp token off the client.
// Or ClickUpBugReporterRepository(apiKey:, listId:) for internal builds.
// Inject secrets with --dart-define, never hardcode them.
repository: PrintingRepository(),
),
child: child!,
),
);
}
}
/// Stands in for a real backend so the example runs with no credentials.
class PrintingRepository implements BugReporterRepository {
@override
Future<BugReportResponse> createReport(CreateReportParams params) async {
debugPrint('report: ${params.title} '
'(${params.severity?.name}/${params.type?.name}, '
'${params.context.length} context rows)');
return const BugReportResponse(success: true, id: 'EXAMPLE-1');
}
}
class HomePage extends StatelessWidget {
const HomePage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(title: const Text('Bug Reporter example')),
body: const Center(
child: Padding(
padding: EdgeInsets.all(24),
child: Text(
'Tap the floating button to capture this screen, annotate it, and '
'file a report.',
textAlign: TextAlign.center,
),
),
),
);
}
}