Context

ImageProvider.loadBuffer is a new method that must be implemented in order to
load images. This API allows asset-based image loading to be performed faster
and with less memory impact on application.

Description of change

When loading asset images, previously the image provider API required multiple
copies of the compressed data. First, when opening the asset the data was
copied into the external heap and exposed to Dart as a typed data array. Then
that typed data array was eventually converted into an ui.ImmutableBuffer,
which internally copies the data into a second structure for decoding.

With the addition of ui.ImmutableBuffer.fromAsset, compressed image bytes can
be loaded directly into the structure used for decoding. Using this approach
requires changes to the byte loading pipeline of ImageProvider. This process
is also faster, because it bypasses some additional scheduling overhead of the
previous method channel based loader.

Migration guide