m3_lightmeter/lib/data/analytics/api/analytics_firebase.dart
Vadim fb58b6cd9f
Upgrade project to the latest stable Flutter version (#201)
* fixed fvm path typo

* Update pubspec.yaml

* version control pubspec.lock

* fixed ios build

* deleted `ExpandableSectionList`

* removed redundant default cases

* avoided async gaps

* replaced deprecated color value getter

* `WillPopScope` -> `PopScope`

* removed theme deprecations

* replaced text scale deprecation

* updated goldens

* updated flutter version across workflows

* [android] migrated to the new gradle

* upgraded dependencies

* [android] fixed build

* [ios] fixed build

* updated config

* allow release notes to fail

* updated stub pubspec

* [android] use java 17

* [ios] enable flutterfire

* added firebase.json to secrets

* typo

* update color utils

* use exact versions

* reverted color utils

* updated goldens
2025-01-20 19:32:57 +01:00

46 lines
1.2 KiB
Dart

import 'package:firebase_analytics/firebase_analytics.dart';
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:flutter/foundation.dart';
import 'package:lightmeter/data/analytics/api/analytics_api_interface.dart';
class LightmeterAnalyticsFirebase implements ILightmeterAnalyticsApi {
const LightmeterAnalyticsFirebase();
@override
Future<void> logEvent(
String eventName, {
Map<String, Object>? parameters,
}) async {
try {
await FirebaseAnalytics.instance.logEvent(
name: eventName,
parameters: parameters,
);
} on FirebaseException catch (e) {
debugPrint('Firebase Analytics Exception: $e');
} catch (e) {
debugPrint(e.toString());
}
}
@override
Future<void> logCrash(
dynamic exception,
StackTrace? stackTrace, {
dynamic reason,
Iterable<Object> information = const [],
}) async {
FirebaseCrashlytics.instance.recordError(
exception,
stackTrace,
reason: reason,
information: information,
);
}
@override
Future<void> setCustomKey(String key, String value) async {
await FirebaseCrashlytics.instance.setCustomKey(key, value);
}
}