-
-
Notifications
You must be signed in to change notification settings - Fork 284
Add Flutter runtime information #2742
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 3 commits
d3b2989
1fa65d3
65496d4
ce305a1
c8b4793
760c175
04006fb
0fa7d7b
feecc70
1c20261
8095f99
d54096c
1a1584b
6e32339
9638c11
81fd25c
e5e0425
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,77 @@ | ||
| import '../../protocol/sentry_runtime.dart'; | ||
|
|
||
| // The Flutter version information can be fetched via Dart defines, | ||
| // see https://github.com/flutter/flutter/pull/140783. | ||
| // This code lives in the Dart only Sentry code, since the code | ||
| // doesn't require any Flutter dependency. | ||
| // Additionally, this makes it work on background isolates in | ||
| // Flutter, where one may not initialize the whole Flutter Sentry | ||
| // SDK. | ||
|
|
||
| SentryRuntime? get flutterRuntime { | ||
ueman marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| if (FlutterVersion.version == null || | ||
| FlutterVersion.channel == null || | ||
| FlutterVersion.frameworkRevision == null) { | ||
| return null; | ||
| } | ||
|
|
||
| return SentryRuntime( | ||
| name: 'Flutter', | ||
| version: '${FlutterVersion.version} (${FlutterVersion.channel})', | ||
| build: FlutterVersion.frameworkRevision, | ||
| ); | ||
denrase marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| } | ||
|
|
||
| SentryRuntime? get dartFlutterRuntime { | ||
| if (FlutterVersion.dartVersion == null) { | ||
| return null; | ||
| } | ||
|
|
||
| return SentryRuntime( | ||
| name: 'Dart', | ||
| version: FlutterVersion.dartVersion, | ||
| ); | ||
| } | ||
|
|
||
| /// Details about the Flutter version this app was compiled with, | ||
| /// corresponding to the output of `flutter --version`. | ||
| /// | ||
| /// When this Flutter version was build from a fork, or when Flutter runs in a | ||
| /// custom embedder, these values might be unreliable. | ||
| abstract class FlutterVersion { | ||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Since this is code from your Flutter PR, would it also make sense to bring the corresponding tests over? |
||
| const FlutterVersion._(); | ||
|
|
||
| /// The Flutter version used to compile the app. | ||
| static const String? version = bool.hasEnvironment('FLUTTER_VERSION') | ||
| ? String.fromEnvironment('FLUTTER_VERSION') | ||
| : null; | ||
|
|
||
| /// The Flutter channel used to compile the app. | ||
| static const String? channel = bool.hasEnvironment('FLUTTER_CHANNEL') | ||
| ? String.fromEnvironment('FLUTTER_CHANNEL') | ||
| : null; | ||
|
|
||
| /// The URL of the Git repository from which Flutter was obtained. | ||
| static const String? gitUrl = bool.hasEnvironment('FLUTTER_GIT_URL') | ||
| ? String.fromEnvironment('FLUTTER_GIT_URL') | ||
| : null; | ||
|
Comment on lines
+53
to
+56
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be included in a context somewhere? |
||
|
|
||
| /// The Flutter framework revision, as a (short) Git commit ID. | ||
| static const String? frameworkRevision = | ||
| bool.hasEnvironment('FLUTTER_FRAMEWORK_REVISION') | ||
| ? String.fromEnvironment('FLUTTER_FRAMEWORK_REVISION') | ||
| : null; | ||
|
|
||
| /// The Flutter engine revision. | ||
| static const String? engineRevision = | ||
| bool.hasEnvironment('FLUTTER_ENGINE_REVISION') | ||
| ? String.fromEnvironment('FLUTTER_ENGINE_REVISION') | ||
| : null; | ||
|
|
||
| // This is included since [Platform.version](https://api.dart.dev/stable/dart-io/Platform/version.html) | ||
| // is not included on web platforms. | ||
| /// The Dart version used to compile the app. | ||
| static const String? dartVersion = bool.hasEnvironment('FLUTTER_DART_VERSION') | ||
|
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It's slightly different than
|
||
| ? String.fromEnvironment('FLUTTER_DART_VERSION') | ||
| : null; | ||
| } | ||
Uh oh!
There was an error while loading. Please reload this page.