Skip to content

Commit

Permalink
Link talker to crashlytics
Browse files Browse the repository at this point in the history
  • Loading branch information
LezdCS committed May 16, 2024
1 parent 340a7ef commit 597d441
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
3 changes: 3 additions & 0 deletions lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import 'package:get_storage/get_storage.dart';
import 'package:irllink/routes/app_pages.dart';
import 'package:irllink/src/bindings/login_bindings.dart';
import 'package:irllink/src/core/resources/themes.dart';
import 'package:irllink/src/core/utils/crashlytics_talker_observer.dart';
import 'package:irllink/src/presentation/views/login_view.dart';
import 'package:kick_chat/kick_chat.dart';
import 'package:package_info_plus/package_info_plus.dart';
Expand All @@ -23,8 +24,10 @@ import 'src/core/utils/globals.dart' as globals;

void main() async {
WidgetsFlutterBinding.ensureInitialized();
final crashlyticsTalkerObserver = CrashlyticsTalkerObserver();
final talker = TalkerFlutter.init(
settings: TalkerSettings(),
observer: crashlyticsTalkerObserver,
);
await initializeService();
await GetStorage.init();
Expand Down
24 changes: 24 additions & 0 deletions lib/src/core/utils/crashlytics_talker_observer.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import 'package:firebase_crashlytics/firebase_crashlytics.dart';
import 'package:talker_flutter/talker_flutter.dart';

class CrashlyticsTalkerObserver extends TalkerObserver {
CrashlyticsTalkerObserver();

@override
void onError(err) {
FirebaseCrashlytics.instance.recordError(
err.error,
err.stackTrace,
reason: err.message,
);
}

@override
void onException(err) {
FirebaseCrashlytics.instance.recordError(
err.exception,
err.stackTrace,
reason: err.message,
);
}
}

0 comments on commit 597d441

Please sign in to comment.