mirror of
https://github.com/vodemn/m3_lightmeter.git
synced 2024-11-27 01:40:40 +00:00
22 lines
724 B
Dart
22 lines
724 B
Dart
import 'dart:developer';
|
|
|
|
import 'package:firebase_core/firebase_core.dart';
|
|
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
|
|
import 'package:flutter/foundation.dart';
|
|
|
|
import 'package:lightmeter/firebase_options.dart';
|
|
|
|
Future<void> initializeFirebase({required bool handleErrors}) async {
|
|
try {
|
|
await Firebase.initializeApp(options: DefaultFirebaseOptions.currentPlatform);
|
|
if (handleErrors) {
|
|
FlutterError.onError = FirebaseCrashlytics.instance.recordFlutterFatalError;
|
|
PlatformDispatcher.instance.onError = (error, stack) {
|
|
FirebaseCrashlytics.instance.recordError(error, stack, fatal: true);
|
|
return true;
|
|
};
|
|
}
|
|
} catch (e) {
|
|
log(e.toString());
|
|
}
|
|
}
|