Skip to content

Add support for ImageStreamListener.onChunk() - #33092

Merged
tvolkert merged 5 commits into
flutter:masterfrom
tvolkert:chunks
May 21, 2019
Merged

tvolkert merged 5 commits into
flutter:masterfrom
tvolkert:chunks

Conversation

@tvolkert

Copy link
Copy Markdown
Contributor

Description

This is another step towards supporting image loading
progress notification at the widgets layer.

This adds an ImageChunkEvent class along with associated
ImageChunkListener callback signature and an onChunk
property to ImageStreamListener. The events serve to
notify registered listeners when byte chunks are received
while loading an image.

Related Issues

#32374

Tests

I added the following tests:

  • Verification that an ImageProvider notifies listeners of chunk events
  • Verification that MultiFrameImageStreamCompleter delivers chunk events to listeners
  • Verification that MultiFrameImageStreamCompleter drops chunk events on the floor before listeners are registered (intended behavior).
  • Verification that errors reported on the chunk stream that's passed to MultiFrameImageStreamCompleter are properly reported.

Checklist

  • I read the [Contributor Guide] and followed the process outlined there for submitting PRs.
  • I signed the [CLA].
  • I read and followed the [Flutter Style Guide], including [Features we expect every widget to implement].
  • I updated/added relevant documentation (doc comments with ///).
  • All existing and new tests are passing.
  • The analyzer (flutter analyze --flutter-repo) does not report any problems on my PR.
  • I am willing to follow-up on review comments in a timely manner.

Breaking Change

Does your PR require Flutter developers to manually update their apps to accommodate your change?

  • Yes, this is a breaking change (Please read [Handling breaking changes]). Replace this with a link to the e-mail where you asked for input on this proposed change.
  • No, this is not a breaking change.

This is another step towards supporting image loading
progress notification at the widgets layer.

This adds an `ImageChunkEvent` class along with associated
`ImageChunkListener` callback signature and an `onChunk`
property to `ImageStreamListener`. The events serve to
notify registered listeners when byte chunks are received
while loading an image.

#32374
@tvolkert
tvolkert requested a review from goderbauer May 21, 2019 00:52
Comment thread packages/flutter/lib/src/painting/image_stream.dart Outdated
Comment thread packages/flutter/lib/src/painting/image_stream.dart
Comment thread packages/flutter/test/painting/image_stream_test.dart Outdated
Comment thread packages/flutter/lib/src/painting/image_provider.dart
Comment thread packages/flutter/lib/src/painting/image_stream.dart Outdated
Comment thread packages/flutter/lib/src/painting/image_stream.dart

@goderbauer goderbauer left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@tvolkert
tvolkert merged commit 27d3c2f into flutter:master May 21, 2019
@tvolkert
tvolkert deleted the chunks branch May 21, 2019 21:55
tvolkert added a commit that referenced this pull request May 23, 2019
@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Aug 6, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants