_Platform:_
_IDE:_
_split-debug-info and obfuscate (Flutter Android or iOS) or CanvasKit (Flutter Web):_
_Platform installed with:_
Output of the command flutter doctor -v below:
[✓] Flutter (Channel stable, 2.0.1, on Mac OS X 10.15.7 19H524 darwin-x64, locale zh-Hans-CN)
• Flutter version 2.0.1 at /Users/tom/opt/flutter
• Framework revision c5a4b4029c (7 天前), 2021-03-04 09:47:48 -0800
• Engine revision 40441def69
• Dart version 2.12.0
• Pub download mirror https://pub.flutter-io.cn
• Flutter download mirror https://storage.flutter-io.cn
[✓] Android toolchain - develop for Android devices (Android SDK version 29.0.3)
• Android SDK at /Users/tom/Library/Android/sdk
• Platform android-30, build-tools 29.0.3
• ANDROID_SDK_ROOT = /Users/tom/Library/Android/sdk
• Java binary at: /Users/tom/Library/Application
Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7042882/Android
Studio.app/Contents/jre/jdk/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS
• Xcode at /Applications/Xcode.app/Contents/Developer
• Xcode 12.4, Build version 12D4e
• CocoaPods version 1.10.0
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 4.1)
• Android Studio at /Users/tom/Library/Application
Support/JetBrains/Toolbox/apps/AndroidStudio/ch-0/201.7042882/Android Studio.app/Contents
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
• Java version OpenJDK Runtime Environment (build 1.8.0_242-release-1644-b3-6915495)
[✓] IntelliJ IDEA Ultimate Edition (version 2020.3)
• IntelliJ at /Users/tom/Applications/JetBrains Toolbox/IntelliJ IDEA Ultimate.app
• Flutter plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/9212-flutter
• Dart plugin can be installed from:
🔨 https://plugins.jetbrains.com/plugin/6351-dart
[✓] VS Code (version 1.53.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.20.0
[✓] Proxy Configuration
• HTTP_PROXY is set
• NO_PROXY is 127.0.0.1,localhost
• NO_PROXY contains 127.0.0.1
• NO_PROXY contains localhost
[✓] Connected device (3 available)
• JSN AL00a (mobile) • xxx • android-arm64 • Android 10 (API 29)
• iPhone 11 (mobile) • 1xxx7 • ios •
com.apple.CoreSimulator.SimRuntime.iOS-14-4 (simulator)
• Chrome (web) • chrome • web-javascript • Google Chrome
89.0.4389.82
• No issues found!
The version of the SDK (See pubspec.lock):
latest
I have the following issue:
Hi thanks for the lib! I want to know when an event has sent successfully. In my case, when a bug occurs, I show a dialog to the user, and tell them that they should exit and restart the app. Therefore, I have to know when Sentry has finish sending the bug information - otherwise if I exit the app too quickly, the bug information may lost!
Thanks!
Steps to reproduce:
Actual result:
Expected result:
@fzyzcjy thanks for reporting.
I believe you're using the sentry_flutter integration right: https://docs.sentry.io/platforms/flutter/configuration/draining/
so if you do a await Sentry.captureException(...), and awaits the execution, this would be enough to have this event cached to the disk, or could experience a different behavior?
@marandaneto Sure. But I want a global method to do so (would be better if can be done in a processor).
Thank you!
I see, it's part of our unified API having a Sentry#flush(timeout) method, but as Flutter app's don't totally crash, we didn't see the need for it.
Events will be sent on Apps. restart anyway.
Could you explain your use case that can't wait for such restart?
the bug information may lost!
could you reproduce that actually? otherwise, this would be a bug.
@marandaneto My use case:
showDialog to tell the user that "a bug occurs"exit(0) and in android System.exit(0).If the user clicks the exit button quickly enough, I am afraid that sentry does not have enough time to save the information. Please correct me if I am wrong.
Or, if I just wait for 1 second (or 0.5 second? 2 seconds?) before calling System.exit, will it be ensured that the information will never be lost?
Thank you!
@fzyzcjy ok I guess I understood it, as you detect if an event happened thru an event processor, the event is still in the pipeline to be sent, and indeed if the user closes the App. right away, they might lose it.
So 1st thing, it'd be better for you to use the beforeSend callback https://docs.sentry.io/platforms/flutter/configuration/filtering/#using-beforesend which is the last step in the event pipeline before calling the transport layer, an event processor happens much earlier.
a workaround, for now, would be as you said, showDialog with a progress bar for a while (its a magic number right, how fast the serialization + caching to the disk depends on the device), I guess 1s is more than enough.
I'll discuss this internally if we intend to offer such a mechanism, thanks.
just out of curiosity, why would you entirely close the App instead of recovering from the error?
@marandaneto Thanks for the reply!
just out of curiosity, why would you entirely close the App instead of recovering from the error?
Because I observe the following situation: After an uncaught error (i.e. the errors captured by Sentry), if I continue using the app, I find that, its internal state seems to be broken, and starts throwing some strange errors once in a while (you know, since the states are broken now).
I am not very experienced, so could you please provide some suggestions on error recovery?
@fzyzcjy got it, makes sense.
well, error recovery much depends on your App. business logic, it's pretty much coding that everything goes back to "normal" once an unexpected error happened, thanks for your reply.
@marandaneto Thank you for the reply!
@fzyzcjy we are often hanging out on our discord btw, feel free to join us #flutter :) https://discord.gg/PXa5Apfe7K
@marandaneto I joined just now :) (Though I seldom use Discord)
Most helpful comment
@marandaneto I joined just now :) (Though I seldom use Discord)