diff --git a/CHANGELOG.md b/CHANGELOG.md index 71483dab8e..55773a0b75 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ - Add `ConnectivityIntegration` for web ([#1765](https://github.com/getsentry/sentry-dart/pull/1765)) - We only get the info if online/offline on web platform. The added breadcrumb is set to either `wifi` or `none`. - APM for isar ([#1726](https://github.com/getsentry/sentry-dart/pull/1726)) +- Starting with Flutter 3.16, Sentry adds the [`appFlavor`](https://api.flutter.dev/flutter/services/appFlavor-constant.html) to the `flutter_context` ([#1799](https://github.com/getsentry/sentry-dart/pull/1799)) ## 7.14.0 diff --git a/flutter/lib/src/event_processor/flutter_enricher_event_processor.dart b/flutter/lib/src/event_processor/flutter_enricher_event_processor.dart index a4d04573a6..615c7a4974 100644 --- a/flutter/lib/src/event_processor/flutter_enricher_event_processor.dart +++ b/flutter/lib/src/event_processor/flutter_enricher_event_processor.dart @@ -153,6 +153,7 @@ class FlutterEnricherEventProcessor implements EventProcessor { // See https://github.com/flutter/flutter/issues/83919 // 'window_is_visible': _window.viewConfiguration.visible, if (renderer != null) 'renderer': renderer, + if (_appFlavor != null) 'appFlavor': _appFlavor!, }; } @@ -266,3 +267,10 @@ class FlutterEnricherEventProcessor implements EventProcessor { return null; } } + +/// Copied from https://api.flutter.dev/flutter/services/appFlavor-constant.html +/// As soon as Flutter 3.16 is the minimal supported version of Sentry, this +/// can be replaced with the property from the link above. +const String? _appFlavor = String.fromEnvironment('FLUTTER_APP_FLAVOR') != '' + ? String.fromEnvironment('FLUTTER_APP_FLAVOR') + : null;