===========
package | build | pub | likes | popularity | pub points |
---|---|---|---|---|---|
sentry_firebase_remote_config |
Integration for firebase_remote_config
package. Track changes to firebase boolean values as feature flags in Sentry.io
-
Sign up for a Sentry.io account and get a DSN at https://sentry.io.
-
Follow the installing instructions on pub.dev.
-
Initialize the Sentry SDK using the DSN issued by Sentry.io.
-
Call...
import 'package:firebase_core/firebase_core.dart';
import 'package:firebase_remote_config_example/home_page.dart';
import 'package:flutter/material.dart';
import 'package:sentry_flutter/sentry_flutter.dart';
import 'package:sentry_firebase_remote_config/sentry_firebase_remote_config.dart';
import 'firebase_options.dart';
Future<void> main() async {
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp(
options: DefaultFirebaseOptions.currentPlatform,
);
final remoteConfig = FirebaseRemoteConfig.instance;
await remoteConfig.setConfigSettings(RemoteConfigSettings(
fetchTimeout: const Duration(minutes: 1),
minimumFetchInterval: const Duration(hours: 1),
));
await SentryFlutter.init(
(options) {
options.dsn = 'https://example@sentry.io/add-your-dsn-here';
final sentryFirebaseRemoteConfigIntegration = SentryFirebaseRemoteConfigIntegration(
firebaseRemoteConfig: remoteConfig,
// Don't call `await remoteConfig.activate();` when firebase config is updated. Per default this is true.
activateOnConfigUpdated: false,
);
options.addIntegration(sentryFirebaseRemoteConfigIntegration);
},
);
runApp(const RemoteConfigApp());
}
class RemoteConfigApp extends StatelessWidget {
const RemoteConfigApp({Key? key}) : super(key: key);
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Remote Config Example',
home: const HomePage(),
theme: ThemeData(
useMaterial3: true,
primarySwatch: Colors.blue,
),
);
}
}