From e7f8216c9e97c155f547e4f975bc53b5d2a30109 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Uek=C3=B6tter?= Date: Mon, 1 Jan 2024 19:27:32 +0100 Subject: [PATCH 1/2] Add app flavor --- CHANGELOG.md | 1 + .../event_processor/flutter_enricher_event_processor.dart | 8 ++++++++ 2 files changed, 9 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71483dab8e..d9e33bf362 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -68,6 +68,7 @@ - Breadcrumbs for database operations ([#1656](https://github.com/getsentry/sentry-dart/pull/1656)) - APM for hive ([#1672](https://github.com/getsentry/sentry-dart/pull/1672)) - Add `attachScreenshotOnlyWhenResumed` to options ([#1700](https://github.com/getsentry/sentry-dart/pull/1700)) +- Starting with Flutter 3.16, Sentry adds the [`appFlavor`](https://api.flutter.dev/flutter/services/appFlavor-constant.html) to the `flutter_context` ([#1700](https://github.com/getsentry/sentry-dart/pull/1700)) ### Dependencies 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; From ab51d146d554c0ab513a1482e9c1b591e261e8ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonas=20Uek=C3=B6tter?= Date: Mon, 1 Jan 2024 19:32:55 +0100 Subject: [PATCH 2/2] fix changelog --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index d9e33bf362..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 @@ -68,7 +69,6 @@ - Breadcrumbs for database operations ([#1656](https://github.com/getsentry/sentry-dart/pull/1656)) - APM for hive ([#1672](https://github.com/getsentry/sentry-dart/pull/1672)) - Add `attachScreenshotOnlyWhenResumed` to options ([#1700](https://github.com/getsentry/sentry-dart/pull/1700)) -- Starting with Flutter 3.16, Sentry adds the [`appFlavor`](https://api.flutter.dev/flutter/services/appFlavor-constant.html) to the `flutter_context` ([#1700](https://github.com/getsentry/sentry-dart/pull/1700)) ### Dependencies