DisposableCachedImage class

Inheritance

Constructors

DisposableCachedImage.asset({required String imagePath, bool keepAlive = false, BoxFit? fit, Rect? centerSlice, Duration fadeDuration = const Duration(milliseconds: 300), OnLoading? onLoading, OnError? onError, double scale = 1.0, double? height, BlendMode? colorBlendMode, Color? color, bool resizeImage = false, BoxShape shape = BoxShape.rectangle, AlignmentGeometry alignment = Alignment.center, bool addRepaintBoundaries = true, FilterQuality filterQuality = FilterQuality.none, double? width, OnImage? onImage, ImageRepeat repeat = ImageRepeat.noRepeat, bool isAntiAlias = false, bool invertColors = false, bool isDynamicHeight = false, bool matchTextDirection = false, BorderRadius? borderRadius, Key? key, bool keepBytesInMemory = true})
Create a widget that displays a local image from asset by providing the image path.
DisposableCachedImage.local({required String imagePath, bool keepAlive = false, BoxFit? fit, Rect? centerSlice, Duration fadeDuration = const Duration(milliseconds: 300), OnLoading? onLoading, OnError? onError, double scale = 1.0, double? height, BlendMode? colorBlendMode, Color? color, bool resizeImage = false, BoxShape shape = BoxShape.rectangle, AlignmentGeometry alignment = Alignment.center, bool addRepaintBoundaries = true, FilterQuality filterQuality = FilterQuality.none, double? width, OnImage? onImage, ImageRepeat repeat = ImageRepeat.noRepeat, bool isAntiAlias = false, bool invertColors = false, bool isDynamicHeight = false, bool matchTextDirection = false, bool keepBytesInMemory = true, BorderRadius? borderRadius, Key? key})
Create a widget that displays a local image from device storage by providing the image path.
DisposableCachedImage.network({bool keepAlive = false, required String imageUrl, Map<String, String>? headers, int? maxCacheWidth, int? maxCacheHeight, BoxFit? fit, Rect? centerSlice, double scale = 1.0, bool addRepaintBoundaries = true, OnImage? onImage, BoxShape shape = BoxShape.rectangle, Color? color, AlignmentGeometry alignment = Alignment.center, OnLoading? onLoading, bool isAntiAlias = false, bool invertColors = false, double? height, BlendMode? colorBlendMode, bool resizeImage = false, bool isDynamicHeight = false, bool matchTextDirection = false, BorderRadius? borderRadius, double? width, ImageRepeat repeat = ImageRepeat.noRepeat, FilterQuality filterQuality = FilterQuality.none, OnError? onError, Duration fadeDuration = const Duration(milliseconds: 300), Key? key, bool keepBytesInMemory = true, Widget progressBuilder(BuildContext context, double progress)?})
Create a widget that displays image from the network and cache it in cache directory.

Properties

addRepaintBoundaries bool
isolates image repaints.
final
alignment AlignmentGeometry
How to align the image within its bounds.
final
borderRadius BorderRadius?
If non-null, the corners of this image are rounded by this BorderRadius.
final
centerSlice Rect?
The center slice for a nine-patch image.
final
color Color?
If non-null, this color is blended with each image pixel using colorBlendMode.
final
colorBlendMode BlendMode?
Used to combine color with this image.
final
fadeDuration Duration
The duration of fade animation.
final
filterQuality FilterQuality
Use filterQuality to specify the rendering quality of the image.
final
fit BoxFit?
How to inscribe the image into the space allocated during layout.
final
hashCode int
The hash code for this object.
no setterinherited
height double?
If non-null, require the image to have this height.
final
invertColors bool
Whether the colors of the image are inverted when drawn.
final
isAntiAlias bool
Whether to paint the image with anti-aliasing.
final
isDynamicHeight bool
Display dynamic height image, this must be enabled if you want to display dynamic height images to avoid UI jumping.
final
keepAlive bool
This should only be enabled for images that must be in memory for the entire application lifecycle
final
keepBytesInMemory bool
option to save this image bytes into memory and reuse it later instead of reading from storage
final
key Key?
Controls how one widget replaces another widget in the tree.
finalinherited
matchTextDirection bool
Whether to paint the image in the direction of the TextDirection.
final
maxCacheHeight int?
Resize the image and save the resized bytes to storage, see resizeImage.
final
maxCacheWidth int?
Resize the image and save the resized bytes to storage, see resizeImage.
final
onError OnError?
A widget to display when an error occurs
final
onImage OnImage?
A widget for displaying the image
final
onLoading OnLoading?
A widget to display when loading the image, downloading the image or getting it from device storage
final
progressBuilder → (Widget Function(BuildContext context, double progress)?)
final
repeat ImageRepeat
How to paint any portions of the layout bounds not covered by the image.
final
resizeImage bool
Resize the image to the given values width and/or height before painting
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
scale double
Specifies the image's scale.
final
shape BoxShape
The image shape.
final
width double?
If non-null, require the image to have this width.
final

Methods

createElement() → ConsumerStatefulElement
Creates a StatefulElement to manage this widget's location in the tree.
inherited
createState() → ConsumerState<DisposableCachedImage>
Creates the mutable state for this widget at a given location in the tree.
debugDescribeChildren() List<DiagnosticsNode>
Returns a list of DiagnosticsNode objects describing this node's children.
inherited
debugFillProperties(DiagnosticPropertiesBuilder properties) → void
Add additional properties associated with the node.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toDiagnosticsNode({String? name, DiagnosticsTreeStyle? style}) DiagnosticsNode
Returns a debug representation of the object that is used by debugging tools and by DiagnosticsNode.toStringDeep.
inherited
toString({DiagnosticLevel minLevel = DiagnosticLevel.info}) String
A string representation of this object.
inherited
toStringDeep({String prefixLineOne = '', String? prefixOtherLines, DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a string representation of this node and its descendants.
inherited
toStringShallow({String joiner = ', ', DiagnosticLevel minLevel = DiagnosticLevel.debug}) String
Returns a one-line detailed description of the object.
inherited
toStringShort() String
A short, textual description of this widget.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

clearCache() Future<void>
Remove all cached images form device storage.