fix: crashlytics
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
import 'dart:async';
|
||||
import 'dart:io';
|
||||
|
||||
import 'package:firebase_core/firebase_core.dart';
|
||||
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_native_splash/flutter_native_splash.dart';
|
||||
@@ -43,6 +45,11 @@ Future<void> lazyBootstrap(
|
||||
],
|
||||
);
|
||||
|
||||
if (container.read(autoCrashReportProvider) && !kDebugMode) {
|
||||
_loggy.debug("initializing crashlytics");
|
||||
await initCrashlytics();
|
||||
}
|
||||
|
||||
final debug = container.read(debugModeNotifierProvider) || kDebugMode;
|
||||
|
||||
final filesEditor = container.read(filesEditorServiceProvider);
|
||||
@@ -95,6 +102,18 @@ void initLoggers(
|
||||
);
|
||||
}
|
||||
|
||||
Future<void> initCrashlytics() async {
|
||||
switch (Platform.operatingSystem) {
|
||||
case "android" || "ios" || "macos":
|
||||
await Firebase.initializeApp();
|
||||
FlutterError.onError =
|
||||
FirebaseCrashlytics.instance.recordFlutterFatalError;
|
||||
default:
|
||||
_loggy.debug("platform is not supported for crashlytics");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Future<void> initAppServices(
|
||||
Result Function<Result>(ProviderListenable<Result>) read,
|
||||
) async {
|
||||
|
||||
Reference in New Issue
Block a user