Skip to content

Commit 1a5e762

Browse files
committed
docs(dart): Add feature flags documentation
1 parent f50b052 commit 1a5e762

File tree

5 files changed

+105
-1
lines changed

5 files changed

+105
-1
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
title: Set Up Feature Flags
3+
sidebar_order: 7000
4+
description: With Feature Flags, Sentry tracks feature flag evaluations in your application, keeps an audit log feature flag changes, and reports any suspicious updates that may have caused an error.
5+
---
6+
7+
<PlatformContent includePath="feature-flags/prerelease-alert" />
8+
9+
## Prerequisites
10+
11+
- You have the <PlatformLink to="/">Sentry SDK version 9 installed</PlatformLink>.
12+
13+
## Enable Evaluation Tracking
14+
15+
If you use a third-party SDK to evaluate feature flags, you can enable a Sentry SDK integration to track those evaluations. Integrations are provider specific. Documentation for supported SDKs is listed below.
16+
17+
- [Firebase Remote Config](/platforms/dart/configuration/integrations/firebase-remote-config/)
18+
19+
### Manual Usage
20+
21+
Per default, the Sentry SDK adds the `FeatureFlagsIntegration`, which allows you to manually track feature flag evaluations.
22+
23+
```dart
24+
Sentry.addFeatureFlag("feature_flag_a", true);
25+
```
26+
27+
Calling this function multiple times with the same flag name will override the previous value.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: Firebase Remote Config
3+
description: "Learn more about the Sentry Firebase Remote Config integration for the Dart SDK."
4+
sidebar_order: 50
5+
redirect_from:
6+
- /platforms/dart/guides/firebase-remote-config/
7+
---
8+
9+
<Include name="dart-integrations/firebase-remote-config.mdx" />
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
title: Firebase Remote Config
3+
description: "Learn more about the Sentry Firebase Remote Config integration for the Flutter SDK."
4+
sidebar_order: 60
5+
redirect_from:
6+
- /platforms/dart/guides/flutter/firebase-remote-config/
7+
---
8+
9+
<Include name="dart-integrations/firebase-remote-config.mdx" />
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: Firebase Remote Config
3+
description: "Learn more about the Sentry Firebase Remote Config integration for the Dart SDK."
4+
sidebar_order: 6
5+
platforms:
6+
- dart
7+
- flutter
8+
---
9+
10+
The `sentry_firebase_remote_config` integration provides [Firebase Remote Config](https://firebase.google.com/docs/remote-config) support for Sentry thus providing insight into feature flag evaluations.
11+
12+
## Behavior
13+
14+
- Adding the `SentryFirebaseRemoteConfig` integration will automatically track feature flag evaluations for boolean Firebase Remote Config values.
15+
- The integration is available in Sentry SDK version 9.0.0 or higher.
16+
17+
## Prerequisites
18+
19+
1. The Sentry [Dart](/platforms/dart/#configure) SDK is initialized.
20+
2. Firebase Remote Config is set up.
21+
22+
## Install
23+
24+
To use the `SentryFirebaseRemoteConfig` integration, add the `sentry_firebase_remote_config` dependency.
25+
26+
```yml {filename:pubspec.yaml}
27+
dependencies:
28+
sentry: ^{{@inject packages.version('sentry.dart', '9.0.0') }}
29+
sentry_firebase_remote_config: ^{{@inject packages.version('sentry.dart.firebase_remote_config', '9.0.0') }}
30+
```
31+
32+
## Configure
33+
34+
Add the `SentryFirebaseRemoteConfig` integration to the Sentry SDK initialization.
35+
36+
```dart
37+
import 'package:sentry/sentry.dart';
38+
import 'package:sentry_firebase_remote_config/sentry_firebase_remote_config.dart';
39+
40+
await Sentry.init(
41+
(options) {
42+
options.dsn = 'https://[email protected]/example';
43+
options.firebaseRemoteConfigIntegration = SentryFirebaseRemoteConfig(
44+
firebaseRemoteConfig: firebaseRemoteConfig,
45+
activateOnUpdate: false, // Per default, the remote config is activated on update. You can opt out by setting this to false.
46+
);
47+
},
48+
);
49+
```
50+
51+
## Verify & View
52+
53+
### 1. Update Firebase Remote Config value
54+
55+
Update a boolean Firebase Remote Config value to true. Keep in mind that values will be evaluated as bool if there string values are `true`, `false`, `1`, or `0`. So keep in mind that numerical values of `1` or `0` will be evaluated as `true` or `false` boolean values.
56+
57+
### 2. View the Recorded Feature Flag Evaluation on Sentry.io
58+
59+
To view the recorded feature flag evaluation, log into [sentry.io](https://sentry.io) and open your project.

includes/dart-integrations/index.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
| [`Slow and Frozen Frames`](/platforms/dart/guides/flutter/integrations/slow-and-frozen-frames-instrumentation) | ✓ * | || |
1515
| [`Sqflite`](/platforms/dart/guides/flutter/integrations/sqflite-instrumentation) | | || |
1616
| [`User Interaction`](/platforms/dart/guides/flutter/integrations/user-interaction-instrumentation) | | |||
17-
17+
| [`Firebase Remote Config`](/platforms/dart/guides/flutter/integrations/firebase-remote-config) | | | ||
1818
<Alert>
1919

2020
*Slow and Frozen Frames* should work automatically, however if `WidgetsFlutterBinding` is initialized before `SentryFlutter.init`, then this instrumentation will not work automatically.

0 commit comments

Comments
 (0)