flutter: sentry: Enable Sentry only on Release Mode

This commit is contained in:
Calcitem 2021-02-16 15:15:46 +08:00
parent 18e77e9003
commit 96b2dd7533
1 changed files with 12 additions and 7 deletions

View File

@ -18,6 +18,7 @@
import 'dart:io'; import 'dart:io';
import 'package:flutter/foundation.dart';
import 'package:flutter/material.dart'; import 'package:flutter/material.dart';
import 'package:flutter/services.dart'; import 'package:flutter/services.dart';
import 'package:flutter_localizations/flutter_localizations.dart'; import 'package:flutter_localizations/flutter_localizations.dart';
@ -29,6 +30,7 @@ import 'services/player.dart';
import 'widgets/main_menu.dart'; import 'widgets/main_menu.dart';
Future<void> main() async { Future<void> main() async {
if (kReleaseMode) {
await SentryFlutter.init( await SentryFlutter.init(
(options) { (options) {
options.dsn = options.dsn =
@ -36,6 +38,9 @@ Future<void> main() async {
}, },
appRunner: () => runApp(SanmillApp()), appRunner: () => runApp(SanmillApp()),
); );
} else {
runApp(SanmillApp());
}
SystemChrome.setPreferredOrientations( SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown], [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown],