2
0
mirror of https://github.com/inventree/inventree-app.git synced 2025-04-28 05:26:47 +00:00

Provide release code to sentry

This commit is contained in:
Oliver 2021-07-29 16:13:15 +10:00
parent b41f1a2ac7
commit 3ae9342a86

View File

@ -8,6 +8,7 @@ import 'package:inventree/widget/home.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:one_context/one_context.dart';
import 'package:package_info_plus/package_info_plus.dart';
import 'dsn.dart';
@ -17,15 +18,23 @@ import 'package:sentry_flutter/sentry_flutter.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await runZonedGuarded<Future<void>>(() async {
PackageInfo info = await PackageInfo.fromPlatform();
String pkg = info.packageName;
String version = info.version;
String build = info.buildNumber;
String release = "${pkg}@${version}:${build}";
await Sentry.init((options) {
options.dsn = SENTRY_DSN_KEY;
options.release = release;
options.environment = isInDebugMode() ? "debug" : "release";
});
WidgetsFlutterBinding.ensureInitialized();
// Pass any flutter errors off to the Sentry reporting context!
FlutterError.onError = (FlutterErrorDetails details) async {