stackdriver_dart 2.0.1
stackdriver_dart: ^2.0.1 copied to clipboard
Flutter package for reporting uncaught application errors and HTTP failures to Google Cloud Error Reporting.
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:stackdriver_dart/stackdriver_dart.dart';
class MyApp extends StatefulWidget {
const MyApp({super.key});
@override
State<MyApp> createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Report Sample',
supportedLocales: const [
Locale('ja', 'JP'),
Locale('en', ''),
],
home: const Center(
child: Text(
'Report Sample',
style: TextStyle(
fontFamily: 'NotoSansJP',
fontSize: 24,
fontWeight: FontWeight.w200,
color: Color.fromRGBO(0, 102, 238, 0.08),
),
),
),
);
}
}
Future<void> main() async {
final config = Config(
projectId: 'PROJECT_ID',
key: 'API_KEY',
service: 'my-app',
version: '1.0.0');
final reporter = StackDriverErrorReporter();
reporter.start(config);
runZonedGuarded(() async {
runApp(const MyApp());
}, (error, trace) {
reporter.report(err: error, trace: trace);
});
}