DioImageProvider class
A custom ImageProvider that uses Dio
to fetch images from a network URL,
with support for a fallback asset image if the network image fails to load.
This provider integrates Dio for custom HTTP configurations like interceptors, headers, and advanced error handling.
- Inheritance
-
- Object
- ImageProvider<
DioImageProvider> - DioImageProvider
Constructors
- DioImageProvider.new({required Uri imageUrl, required String fallbackAssetPath})
-
Creates a DioImageProvider with the required
imageUrl
andfallbackAssetPath
.
Properties
- dio → Dio
-
final
- fallbackAssetPath → String
-
The path to the fallback asset image.
final
- hashCode → int
-
The hash code for this object.
no setteroverride
- imageUrl → Uri
-
The URL of the network image.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
createStream(
ImageConfiguration configuration) → ImageStream -
Called by resolve to create the ImageStream it returns.
inherited
-
evict(
{ImageCache? cache, ImageConfiguration configuration = ImageConfiguration.empty}) → Future< bool> -
Evicts an entry from the image cache.
inherited
-
loadBuffer(
DioImageProvider key, DecoderBufferCallback decode) → ImageStreamCompleter -
Converts a key into an ImageStreamCompleter, and begins fetching the
image.
inherited
-
loadImage(
DioImageProvider key, ImageDecoderCallback decode) → ImageStreamCompleter -
Converts a key into an ImageStreamCompleter, and begins fetching the
image.
override
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
obtainCacheStatus(
{required ImageConfiguration configuration, ImageErrorListener? handleError}) → Future< ImageCacheStatus?> -
Returns the cache location for the key that this ImageProvider creates.
inherited
-
obtainKey(
ImageConfiguration configuration) → Future< DioImageProvider> -
Converts an ImageProvider's settings plus an ImageConfiguration to a key
that describes the precise image to load.
override
-
resolve(
ImageConfiguration configuration) → ImageStream -
Resolves this image provider using the given
configuration
, returning an ImageStream.inherited -
resolveStreamForKey(
ImageConfiguration configuration, ImageStream stream, DioImageProvider key, ImageErrorListener handleError) → void -
Called by resolve with the key returned by obtainKey.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
override