fix(sentry): sync dist parameter to resolve minified stack traces

This commit is contained in:
dab246
2026-02-24 13:49:03 +07:00
committed by Dat H. Pham
parent 9cc92fbfa8
commit 296548a781
3 changed files with 13 additions and 1 deletions
+9
View File
@@ -32,6 +32,11 @@ class SentryConfig {
// Check if Sentry is available
final bool isAvailable;
// The distribution version of the release.
// In this project, it represents the Git SHA passed via `--dart-define=SENTRY_DIST`.
// This must match the `--dist` parameter used when uploading source maps to Sentry.
final String? dist;
SentryConfig({
required this.dsn,
required this.environment,
@@ -42,6 +47,7 @@ class SentryConfig {
this.isDebug = BuildUtils.isDebugMode,
this.attachScreenshot = false,
this.isAvailable = false,
this.dist,
});
/// Load configuration from an env file.
@@ -62,11 +68,14 @@ class SentryConfig {
final appVersion = await ApplicationManager().getAppVersion();
const sentryDist = String.fromEnvironment('SENTRY_DIST');
return SentryConfig(
dsn: sentryDSN,
environment: sentryEnvironment,
release: appVersion,
isAvailable: isAvailable,
dist: sentryDist.isNotEmpty ? sentryDist : null,
);
}
}
@@ -30,6 +30,7 @@ class SentryInitializer {
options.dsn = config.dsn;
options.environment = config.environment;
options.release = config.release;
options.dist = config.dist;
options.tracesSampleRate = config.tracesSampleRate;
options.profilesSampleRate = config.profilesSampleRate;
options.enableLogs = config.enableLogs;