packages
packages copied to clipboard
[image_picker] Adopt code excerpts in README
Improves image_picker_for_web README example and updates it to use code excerpts.
Part of flutter/flutter#102679
Pre-launch Checklist
- [x] I read the Contributor Guide and followed the process outlined there for submitting PRs.
- [x] I read the Tree Hygiene wiki page, which explains my responsibilities.
- [x] I read and followed the relevant style guides and ran the auto-formatter. (Unlike the flutter/flutter repo, the flutter/packages repo does use
dart format.) - [x] I signed the CLA.
- [x] The title of the PR starts with the name of the package surrounded by square brackets, e.g.
[shared_preferences] - [x] I listed at least one issue that this PR fixes in the description above.
- [x] I updated
pubspec.yamlwith an appropriate new version according to the pub versioning philosophy, or this PR is exempt from version changes. - [x] I updated
CHANGELOG.mdto add a description of the change, following repository CHANGELOG style. - [x] I updated/added relevant documentation (doc comments with
///). - [x] I added new tests to check the change I am making, or this PR is test-exempt.
- [x] All existing and new tests are passing.
If you need help, consider asking for advice on the #hackers-new channel on Discord.
- Tweaked the README code a tiny bit to make it more testable.
- Added a small image (from flutter_image/example/assets) in order to test creating an Image widget from an XFile's path.
await XFile.readAsBytes() seems to be causing an issue on web. It's returning a valid Uint8List but for some reason it causes the test to stall indefinitely once it reaches the next await or the end of the test.
Even after creating a blob instead of loading an asset, I'm still having the same issue as before with XFile.readAsBytes(). I can get the test to pass without errors if I replace
image = Image.memory(await pickedFile.readAsBytes());
with this:
final Uint8List bytes = Uint8List.fromList(<int>[0, 1, 2, 3, 4, 5]);
image = Image.memory(bytes);
I'm wondering if it's related to this issue? It's also very possible I'm making a dumb mistake!
@ditman Any thoughts on how to structure this test?
@ditman Ping on the test question above.
Looking!
I moved the test to integration_test and added the missing IntegrationTestWidgetsFlutterBinding.ensureInitialized()... I also did other changes (to ensure that the PNG image is a valid one), but I'm not sure if those were needed. Now the tests run and pass!
@stuartmorgan if you're happy with the new contents of the README, I think this could land.
auto label is removed for flutter/packages/5523, due to - The status or check suite Linux_android android_platform_tests_shard_3 master has failed. Please fix the issues identified (or deflake) before re-applying this label.
The presubmit failure is OOB breakage I just landed a fix for; once that is published I'll re-run.
auto label is removed for flutter/packages/5523, due to - The status or check suite Linux_android android_platform_tests_shard_3 master has failed. Please fix the issues identified (or deflake) before re-applying this label.