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,13 +30,17 @@ import 'services/player.dart';
import 'widgets/main_menu.dart'; import 'widgets/main_menu.dart';
Future<void> main() async { Future<void> main() async {
await SentryFlutter.init( if (kReleaseMode) {
(options) { await SentryFlutter.init(
options.dsn = (options) {
'https://62c565096ba146a6b70bc57dbb72386c@o525088.ingest.sentry.io/5638585'; options.dsn =
}, 'https://62c565096ba146a6b70bc57dbb72386c@o525088.ingest.sentry.io/5638585';
appRunner: () => runApp(SanmillApp()), },
); appRunner: () => runApp(SanmillApp()),
);
} else {
runApp(SanmillApp());
}
SystemChrome.setPreferredOrientations( SystemChrome.setPreferredOrientations(
[DeviceOrientation.portraitUp, DeviceOrientation.portraitDown], [DeviceOrientation.portraitUp, DeviceOrientation.portraitDown],