Skip to content

Commit

Permalink
parse semver
Browse files Browse the repository at this point in the history
  • Loading branch information
buenaflor committed Jul 9, 2024
1 parent df36ae7 commit 805ed2d
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,18 @@ class IoEnricherEventProcessor implements EnricherEventProcessor {
List<SentryRuntime> _getRuntimes(List<SentryRuntime>? runtimes) {
// Pure Dart doesn't have specific runtimes per build mode
// like Flutter: https://flutter.dev/docs/testing/build-modes
final dartRuntime = SentryRuntime(

// Regex taken from semver package
final versionRegex = RegExp(r'^' // Start at beginning.
r'(\d+)\.(\d+)\.(\d+)' // Version number.
r'(-([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?' // Pre-release.
r'(\+([0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*))?' // Build.
r' \((beta|stable)\)'); // Channel.
final version = versionRegex.stringMatch(Platform.version);

SentryRuntime dartRuntime = SentryRuntime(
name: 'Dart',
version: version ?? Platform.version,
rawDescription: Platform.version,
);
if (runtimes == null) {
Expand Down

0 comments on commit 805ed2d

Please sign in to comment.