Skip to content

Commit bde5f6b

Browse files
authored
Add app flavor to flutter_context (#1799)
* Add app flavor * fix changelog
1 parent 404d19f commit bde5f6b

File tree

2 files changed

+9
-0
lines changed

2 files changed

+9
-0
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
- Add `ConnectivityIntegration` for web ([#1765](https://github.com/getsentry/sentry-dart/pull/1765))
1010
- We only get the info if online/offline on web platform. The added breadcrumb is set to either `wifi` or `none`.
1111
- APM for isar ([#1726](https://github.com/getsentry/sentry-dart/pull/1726))
12+
- 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))
1213

1314
## 7.14.0
1415

flutter/lib/src/event_processor/flutter_enricher_event_processor.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ class FlutterEnricherEventProcessor implements EventProcessor {
153153
// See https://github.com/flutter/flutter/issues/83919
154154
// 'window_is_visible': _window.viewConfiguration.visible,
155155
if (renderer != null) 'renderer': renderer,
156+
if (_appFlavor != null) 'appFlavor': _appFlavor!,
156157
};
157158
}
158159

@@ -266,3 +267,10 @@ class FlutterEnricherEventProcessor implements EventProcessor {
266267
return null;
267268
}
268269
}
270+
271+
/// Copied from https://api.flutter.dev/flutter/services/appFlavor-constant.html
272+
/// As soon as Flutter 3.16 is the minimal supported version of Sentry, this
273+
/// can be replaced with the property from the link above.
274+
const String? _appFlavor = String.fromEnvironment('FLUTTER_APP_FLAVOR') != ''
275+
? String.fromEnvironment('FLUTTER_APP_FLAVOR')
276+
: null;

0 commit comments

Comments
 (0)