How to turn off Firebase analytics/crashlytics if I run my app in debug mode?

Viewed 338

When I started using Firebase I remember it had something like:

if (kDebugMode) turnOffFirebase();

but I don't find anywhere what is the actual code.

1 Answers

kDebugMode is the constant, which added inside foundation lib which tells whether the app is running on debug mode or not.

import 'package:flutter/foundation.dart';

FirebaseCrashlytics.instance.setCrashlyticsCollectionEnabled(!kDebugMode);
FirebaseAnalytics().setAnalyticsCollectionEnabled(!kDebugMode);
Related