This repository was archived by the owner on Feb 22, 2023. It is now read-only.
[firebase_crashlytics] Handle case where function isn't in class for stack#1831
Merged
collinjackson merged 6 commits intoflutter:masterfrom Jul 11, 2019
Merged
[firebase_crashlytics] Handle case where function isn't in class for stack#1831collinjackson merged 6 commits intoflutter:masterfrom
collinjackson merged 6 commits intoflutter:masterfrom
Conversation
collinjackson
approved these changes
Jul 10, 2019
Contributor
collinjackson
left a comment
There was a problem hiding this comment.
Looks great! Thanks for adding a test. One suggestion, which I'll commit for you.
|
|
||
| return new StackTraceElement(className == null ? "" : className, methodName, fileName, Integer.parseInt(lineNumber)); | ||
| return new StackTraceElement( | ||
| className == null ? "" : className, methodName, fileName, Integer.parseInt(lineNumber)); |
Contributor
There was a problem hiding this comment.
I think className ?? "" would be more readable
Suggested change
| className == null ? "" : className, methodName, fileName, Integer.parseInt(lineNumber)); | |
| className ?? "", methodName, fileName, Integer.parseInt(lineNumber)); |
Contributor
There was a problem hiding this comment.
Oops, never mind, this is Java not Dart :)
Contributor
Author
There was a problem hiding this comment.
Unless you know something I don't, I don't think that Java has a null coalescing operator yet... (oops, for some reason github didn't show me your second comment until after I wrote this)
Contributor
Author
There was a problem hiding this comment.
But I agree that's definitely more readable 😄
mithun-mondal
pushed a commit
to bKash-developer/archived_plugins
that referenced
this pull request
Aug 6, 2019
…stack (flutter#1831) * Handle case where no class in dart and android (ios is fine)
julianscheel
pushed a commit
to jusst-engineering/plugins
that referenced
this pull request
Mar 11, 2020
…stack (flutter#1831) * Handle case where no class in dart and android (ios is fine)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Currently, the stacktrace parser can't handle it when there is a method without a class in dart - it instead throws its own exception and loses the original one!
This PR handles the case where there is no class name.
There is a slight caveat to the fix on Android - firebase reporting uses a StackTraceElement which requires a class (which makes sense in Java since you can't have Class-less methods), so on Android class-less methods are reported as
.<functionName>whereas on iOS they are simply reported as<className>.I don't think this is a big problem as there seem to be other differences between how the stacktraces are reported on Android and iOS anyways.
i.e. iOS:

Android:

Related Issues
Checklist
Before you create this PR confirm that it meets all requirements listed below by checking the relevant checkboxes (
[x]). This will ensure a smooth and quick review process.///).flutter analyze) does not report any problems on my PR.Breaking Change
Does your PR require plugin users to manually update their apps to accommodate your change?