loadImage method

Loads the image asynchronously using the given key and decode callback.

This method attempts to fetch the image from the network using Dio. If the network request succeeds, it decodes the image bytes. If the network request fails (e.g., due to connectivity issues or a 404 error), it loads and decodes the fallback asset image specified by fallbackAssetPath.

The decode callback is used to decode the image data into an ui.Codec, which is then used to obtain the image frames.

This method returns a OneFrameImageStreamCompleter that completes with the loaded image.

Implementation

@override
ImageStreamCompleter loadImage(
    DioImageProvider key, ImageDecoderCallback decode) {
  return OneFrameImageStreamCompleter(_loadAsync(key, decode));
}