Skip to content

Instantly share code, notes, and snippets.

@mrgulshanyadav
Created October 4, 2020 18:21
Show Gist options
  • Save mrgulshanyadav/596c21f9adaa2f670a23a126e963469a to your computer and use it in GitHub Desktop.
Save mrgulshanyadav/596c21f9adaa2f670a23a126e963469a to your computer and use it in GitHub Desktop.
Sentry Integration example
import 'dart:async';
import 'package:flutter/material.dart';
import 'package:sentry/sentry.dart';
final sentry = SentryClient(dsn: "https://[email protected]/1951746"); // change dsn with your own
void main() async {
runZonedGuarded(
() => runApp(MyApp()),
(error, stackTrace) async {
await sentry.captureException(
exception: error,
stackTrace: stackTrace,
);
},
);
FlutterError.onError = (details, {bool forceReport = false}) {
sentry.captureException(
exception: details.exception,
stackTrace: details.stack,
);
};
}
class MyApp extends StatefulWidget {
@override
_MyAppState createState() => _MyAppState();
}
class _MyAppState extends State<MyApp> {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
body: Container(),
)
);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment