-
-
Notifications
You must be signed in to change notification settings - Fork 255
Implement loadStructuredBinaryData
from updated AssetBundle
#1272
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
Conversation
Thank you @arnemolland |
It can be made backwards compatible as shown in #1166 (comment) |
Updated the PR, would you prefer not using the inner asset bundle? |
Codecov ReportPatch coverage:
Additional details and impacted files@@ Coverage Diff @@
## main #1272 +/- ##
==========================================
+ Coverage 89.76% 89.83% +0.06%
==========================================
Files 155 155
Lines 5032 5064 +32
==========================================
+ Hits 4517 4549 +32
Misses 515 515
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is currently failing because bundle.loadStructuredBinaryData
isn't available on the min Flutter version which Sentry supports. Therefore, we need to apply the suggested "hack" to make it compatible with the min as well as the max Flutter versions supported by Sentry.
You also need to add a changelog entry.
This PR fixes:
sentry_asset_bundle
usesloadStructuredBinaryData
which has a breaking change in latest master channel #1166- Latest version is not compatible with Flutter 3.7 #1289
- SentryAssetBundle implementation is missing #1286
- Issue after upgrading to Flutter 3.8.0-10.1.pre #1293
(They're marked as completed because of this PR, I guess)
Thanks! Added the suggested changes. |
Fixed an issue with type argument not being implicitly forwarded to the dynamic |
@arnemolland since this is possible using the |
Sure thing, I'll rebase |
There are some conflicts, search for |
Had to tidy up locally, should be good now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @arnemolland
@arnemolland there are 4 failing tests, mind checking out? |
Yes, seems to be related to tests running from stable trying to invoke the non-existing method, fixing that asap. |
As expected, calling The quickest fix is to apply the second suggestion found here -- updating the PR. |
My solution to the above problem was to refactor the code to emulate the AssetBundle's Future<T> _loadStructuredBinaryDataWrapper<T>(
String key,
FutureOr<T> Function(ByteData data) parser,
) async {
final ByteData data = await load(key);
return parser(data);
} This can be refactored back once the library drops backwards compatibility with Flutter < 3.8. LMK if this is an acceptable approach. |
I don't think emulating is the way to go, as the Instead, you can adjust the sentry-dart/flutter/test/sentry_asset_bundle_test.dart Lines 566 to 578 in 5e79e10
Because the newly introduced method is then also available in all Flutter versions in the tests, every thing should be working. I've done that in the past, see #877 as a reference how to do that. |
Perfect, thanks! |
📜 Description
Implements
loadStructuredBinaryData
, which is a new method added to Flutter's abstract AssetBundle class in flutter/flutter#119277.💡 Motivation and Context
This change has to be included in order to support what is now the master channel of Flutter and what will hit stable down the road.
💚 How did you test it?
Duped and tweaked the tests for
loadStructuredData
.📝 Checklist
sendDefaultPii
is enabled🔮 Next steps