add sentry.

master
DebuggerX 2 years ago
parent 4395d8888e
commit 9218eb646e

@ -7,6 +7,7 @@ import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_acrylic/flutter_acrylic.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:url_launcher/url_launcher_string.dart';
import 'package:window_manager/window_manager.dart';
import 'package:zbar_scan_plugin/zbar_scan_plugin.dart' as zbar;
@ -35,7 +36,19 @@ Future main() async {
await windowManager.focus();
});
runApp(const MyApp());
await SentryFlutter.init(
(options) {
options.dsn = 'https://6b0c6212196241fa88df20dfcc495c4a@o644838.ingest.sentry.io/4505045898166272';
options.tracesSampleRate = 1.0;
options.reportPackages = false;
Sentry.configureScope(
(scope) => scope.setUser(
SentryUser(username: Platform.environment['USER']),
),
);
},
appRunner: () => runApp(const MyApp()),
);
}
class MyApp extends StatelessWidget {
@ -100,6 +113,12 @@ class _MyHomePageState extends State<MyHomePage> {
status = codes.isEmpty ? Status.notFound : Status.found;
});
}
Sentry.captureMessage(
'Found ${result.length} codes.',
withScope: (scope) {
SentryUser(username: Platform.environment['USER']);
},
);
Future.delayed(const Duration(seconds: 3), () {
if (status == Status.notFound) {
exit(0);
@ -125,6 +144,9 @@ class _MyHomePageState extends State<MyHomePage> {
@override
Widget build(BuildContext context) {
if (MediaQuery.of(context).size.shortestSide < 10) {
return const SizedBox.shrink();
}
return GestureDetector(
onTap: () {
if ([

@ -8,6 +8,7 @@
#include <flutter_acrylic/flutter_acrylic_plugin.h>
#include <screen_retriever/screen_retriever_plugin.h>
#include <sentry_flutter/sentry_flutter_plugin.h>
#include <url_launcher_linux/url_launcher_plugin.h>
#include <window_manager/window_manager_plugin.h>
@ -18,6 +19,9 @@ void fl_register_plugins(FlPluginRegistry* registry) {
g_autoptr(FlPluginRegistrar) screen_retriever_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "ScreenRetrieverPlugin");
screen_retriever_plugin_register_with_registrar(screen_retriever_registrar);
g_autoptr(FlPluginRegistrar) sentry_flutter_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "SentryFlutterPlugin");
sentry_flutter_plugin_register_with_registrar(sentry_flutter_registrar);
g_autoptr(FlPluginRegistrar) url_launcher_linux_registrar =
fl_plugin_registry_get_registrar_for_plugin(registry, "UrlLauncherPlugin");
url_launcher_plugin_register_with_registrar(url_launcher_linux_registrar);

@ -5,6 +5,7 @@
list(APPEND FLUTTER_PLUGIN_LIST
flutter_acrylic
screen_retriever
sentry_flutter
url_launcher_linux
window_manager
)

@ -42,6 +42,7 @@ dependencies:
zbar_scan_plugin:
git:
url: https://github.com/debuggerx01/zbar_scan_plugin.git
sentry_flutter: ^7.4.2
dev_dependencies:
flutter_test:

Loading…
Cancel
Save