File tree Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Expand file tree Collapse file tree 2 files changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -360,7 +360,11 @@ class Sentry {
360360 /// Gets the current active transaction or span bound to the scope.
361361 static ISentrySpan ? getSpan () => _hub.getSpan ();
362362
363- static Future <void > addFeatureFlag (String name, bool value) async {
363+ static Future <void > addFeatureFlag (String name, dynamic value) async {
364+ if (value is ! bool ) {
365+ return ;
366+ }
367+
364368 final featureFlagsIntegration = currentHub.options.integrations
365369 .whereType <FeatureFlagsIntegration >()
366370 .firstOrNull;
Original file line number Diff line number Diff line change @@ -301,7 +301,7 @@ void main() {
301301 );
302302 }, onPlatform: {'vm' : Skip ()});
303303
304- test ('should add feature flagg FeatureFlagsIntegration' , () async {
304+ test ('should add feature flag FeatureFlagsIntegration' , () async {
305305 await Sentry .init (
306306 options: defaultTestOptions (),
307307 (options) => options.dsn = fakeDsn,
@@ -321,6 +321,21 @@ void main() {
321321 );
322322 });
323323
324+ test ('addFeatureFlag should ignore non-boolean values' , () async {
325+ await Sentry .init (
326+ options: defaultTestOptions (),
327+ (options) => options.dsn = fakeDsn,
328+ );
329+
330+ await Sentry .addFeatureFlag ('foo1' , 'some string' );
331+ await Sentry .addFeatureFlag ('foo2' , 123 );
332+ await Sentry .addFeatureFlag ('foo3' , 1.23 );
333+
334+ final featureFlagsContext =
335+ Sentry .currentHub.scope.contexts[SentryFeatureFlags .type];
336+ expect (featureFlagsContext, isNull);
337+ });
338+
324339 test ('should close integrations' , () async {
325340 final integration = MockIntegration ();
326341
You can’t perform that action at this time.
0 commit comments