howtodothatandthis
howtodothatandthis

Reputation: 51

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

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.

Upvotes: 5

Views: 1977

Answers (1)

Jitesh Mohite
Jitesh Mohite

Reputation: 34210

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);

Upvotes: 12

Related Questions