sentry-dart
sentry-dart copied to clipboard
Report version of Dart and Flutter
Came up on: https://github.com/flutter/flutter/issues/61814
The goal is to include the 'runtime' interface with the Dart and/or Flutter version. If there's still no API for this, perhaps we can get this at compile time
The only way I see to archive this currently is to advise the user to include the pubspec.yaml file as an asset and read the dart and flutter version constraints at runtime from it. Like this This is a Flutter only solution.
We could add compile time code generation but that requires the user to add a sentry dev dependency, execute the code generation and somehow notify Sentry of the generated code (because there's no reflection in Flutter). Code generation would work for pure Dart and Flutter though.
also for context https://github.com/flutter/flutter/issues/11481
We could add compile time code generation but that requires the user to add a sentry dev dependency, execute the code generation and somehow notify Sentry of the generated code (because there's no reflection in Flutter). Code generation would work for pure Dart and Flutter though.
Having some code of ours running at part of the build is required for uploading proguard mapping files for Android and debug files for iOS. On Flutter right now it's not a requirement, unless split-debug-info which I assume can become more widely adopted (since folks want smaller apps at the end of the day).
Given that, it doesn't sound unreasonable for us to have a dart tool of sorts that ppl can add to their Flutter builds. And with this tool we could hook into the build to say: Get the Flutter version and replace it on a placeholder variable in a .dart file before compilation. And also do things such as automate debug file upload.
yeah the idea is that we have some code that is run during the build time that can inject some values either as code generation or env. var. that could be read at runtime, I'd be fine either way, this is ideally done along with the automatization of uploading debug files automatically as it'd be pretty much the same plugin.
If there were some kind of generation, maybe this could also help with https://github.com/getsentry/sentry-dart/issues/265
Dart issue for exposing more information at runtime: https://github.com/dart-lang/sdk/issues/46347
We'd need a plugin that does flutter -version and parse the output during compile time or even before, and later generate code with the metadata to be set at runtime.
We already have this btw.
As a work around for as long as querying the Flutter version is not officially supported, we could offer to read it from a dart define and document the key.
So when the app is build with flutter build apk --dart-define flutterVersion=3.7.7 Sentry automatically attaches that version to the runtime.
True, it's a small baby step, you can do that yourself already actually using the beforeSend or an event processor, but yeah automatic would be better.