CachedNetworkImage class
Image widget to show NetworkImage with caching functionality.
- Inheritance
-
- Object
- DiagnosticableTree
- Widget
- StatelessWidget
- CachedNetworkImage
- Available extensions
Constructors
-
CachedNetworkImage({Key? key, required String imageUrl, Map<
String, String> ? httpHeaders, ImageWidgetBuilder? imageBuilder, PlaceholderWidgetBuilder? placeholder, ProgressIndicatorBuilder? progressIndicatorBuilder, LoadingErrorWidgetBuilder? errorWidget, Duration? fadeOutDuration = const Duration(milliseconds: 1000), Curve fadeOutCurve = Curves.easeOut, Duration fadeInDuration = const Duration(milliseconds: 500), Curve fadeInCurve = Curves.easeIn, double? width, double? height, BoxFit? fit, Alignment alignment = Alignment.center, ImageRepeat repeat = ImageRepeat.noRepeat, bool matchTextDirection = false, BaseCacheManager? cacheManager, bool useOldImageOnUrlChange = false, Color? color, FilterQuality filterQuality = FilterQuality.low, BlendMode? colorBlendMode, Duration? placeholderFadeInDuration, int? memCacheWidth, int? memCacheHeight, String? cacheKey, int? maxWidthDiskCache, int? maxHeightDiskCache, ValueChanged<Object> ? errorListener, ImageRenderMethodForWeb imageRenderMethodForWeb = ImageRenderMethodForWeb.HtmlImage, double scale = 1.0}) - CachedNetworkImage shows a network image using a caching mechanism. It also provides support for a placeholder, showing an error and fading into the loaded image. Next to that it supports most features of a default Image widget.
Properties
- alignBottomCenter → Widget
-
Available on Widget, provided by the AlignmentExtension extension
Aligns the widget to the bottom center of its parent.no setter - alignBottomEnd → Widget
-
Available on Widget, provided by the AlignmentExtension extension
Aligns the widget to the bottom end corner of its parent.no setter - alignBottomStart → Widget
-
Available on Widget, provided by the AlignmentExtension extension
Aligns the widget to the bottom start corner of its parent.no setter - alignCenter → Widget
-
Available on Widget, provided by the AlignmentExtension extension
Aligns the widget to the center of its parent.no setter - alignEndCenter → Widget
-
Available on Widget, provided by the AlignmentExtension extension
Aligns the widget to the start center of its parent.no setter - alignment → Alignment
-
How to align the image within its bounds.
final
- alignStartCenter → Widget
-
Available on Widget, provided by the AlignmentExtension extension
Aligns the widget to the start center of its parent.no setter - alignTopCenter → Widget
-
Available on Widget, provided by the AlignmentExtension extension
Aligns the widget to the top center of its parent.no setter - alignTopEnd → Widget
-
Available on Widget, provided by the AlignmentExtension extension
Aligns the widget to the top end corner of its parent.no setter - alignTopStart → Widget
-
Available on Widget, provided by the AlignmentExtension extension
Aligns the widget to the top start corner of its parent.no setter - cacheKey → String?
-
The target image's cache key.
final
- cacheManager → BaseCacheManager?
-
Option to use cacheManager with other settings
final
- center → Widget
-
Available on Widget, provided by the CenterExtension extension
Wraps the widget with a Center widget.no setter - 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
-
errorListener
→ ValueChanged<
Object> ? -
Listener to be called when images fails to load.
final
- errorWidget → LoadingErrorWidgetBuilder?
-
Widget displayed while the target imageUrl failed loading.
final
- fadeInCurve → Curve
-
The curve of the fade-in animation for the imageUrl.
final
- fadeInDuration → Duration
-
The duration of the fade-in animation for the imageUrl.
final
- fadeOutCurve → Curve
-
The curve of the fade-out animation for the placeholder.
final
- fadeOutDuration → Duration?
-
The duration of the fade-out animation for the placeholder.
final
- filterQuality → FilterQuality
-
Target the interpolation quality for image scaling.
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
-
httpHeaders
→ Map<
String, String> ? -
Optional headers for the http request of the image url
final
- imageBuilder → ImageWidgetBuilder?
-
Optional builder to further customize the display of the image.
final
- imageUrl → String
-
The target image that is displayed.
final
- key → Key?
-
Controls how one widget replaces another widget in the tree.
finalinherited
- ltr → Widget
-
Available on Widget, provided by the DirectionalityExtension extension
Wraps the current widget in a Directionality widget with TextDirection.ltr.no setter - matchTextDirection → bool
-
Whether to paint the image in the direction of the TextDirection.
final
- maxHeightDiskCache → int?
-
Will resize the image and store the resized image in the disk cache.
final
- maxWidthDiskCache → int?
-
Will resize the image and store the resized image in the disk cache.
final
- memCacheHeight → int?
-
Will resize the image in memory to have a certain height using ResizeImage
final
- memCacheWidth → int?
-
Will resize the image in memory to have a certain width using ResizeImage
final
- placeholder → PlaceholderWidgetBuilder?
-
Widget displayed while the target imageUrl is loading.
final
- placeholderFadeInDuration → Duration?
-
The duration of the fade-in animation for the placeholder.
final
- progressIndicatorBuilder → ProgressIndicatorBuilder?
-
Widget displayed while the target imageUrl is loading.
final
- repeat → ImageRepeat
-
How to paint any portions of the layout bounds not covered by the image.
final
- rtl → Widget
-
Available on Widget, provided by the DirectionalityExtension extension
Wraps the current widget in a Directionality widget with TextDirection.rtl.no setter - runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- useOldImageOnUrlChange → bool
-
When set to true it will animate from the old image to the new image
if the url changes.
final
- width → double?
-
If non-null, require the image to have this width.
final
Methods
-
alignedBox(
{double? width, double? height, AlignmentDirectional? alignment}) → Widget -
Available on Widget, provided by the SizedBoxExtension extension
Creates a SizedBox with specified width, height, and alignment. -
animatedOpacity(
bool isVisible, {Duration duration = const Duration(milliseconds: 300)}) → AnimatedOpacity -
Available on Widget, provided by the VisibilityExtension extension
Wraps the widget with an AnimatedOpacity widget to animate its visibility. -
box(
{double? width, double? height}) → Widget -
Available on Widget, provided by the SizedBoxExtension extension
Creates a SizedBox with both width and height. -
build(
BuildContext context) → Widget -
Describes the part of the user interface represented by this widget.
override
-
createElement(
) → StatelessElement -
Creates a StatelessElement to manage this widget's location in the tree.
inherited
-
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
-
expandBox(
) → Widget -
Available on Widget, provided by the SizedBoxExtension extension
Creates a SizedBox that fills the available space in both dimensions. -
expanded(
{int flex = 1}) → Widget -
Available on Widget, provided by the FlexExtensions extension
Wraps the current widget with anExpandedwidget, allowing it to expand and fill available space in a flex container (e.g.,Row,Column). -
flexible(
{int flex = 1, FlexFit fit = FlexFit.loose}) → Widget -
Available on Widget, provided by the FlexExtensions extension
Wraps the current widget with aFlexiblewidget, allowing it to take flexible space within a flex container, but with more control over its layout behavior. -
flexibleBox(
{required double width, double? height}) → Widget -
Available on Widget, provided by the SizedBoxExtension extension
Creates a SizedBox with a flexible width and height. -
height(
double height) → Widget -
Available on Widget, provided by the SizedBoxExtension extension
Creates a SizedBox with a specified height. -
hide(
bool isHidden) → Widget -
Available on Widget, provided by the VisibilityExtension extension
Conditionally hides the widget by replacing it with an empty widget (SizedBox.shrink). -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
paddedBox(
{double? width, double? height, EdgeInsets? padding}) → Widget -
Available on Widget, provided by the SizedBoxExtension extension
Creates a SizedBox with padding around the child widget. -
paddingAll(
double value) → Widget -
Available on Widget, provided by the PaddingExtension extension
Wraps the widget with a Padding widget applying uniform padding on all sides. -
paddingOnly(
{double top = 0, double bottom = 0, double start = 0, double end = 0}) → Widget -
Available on Widget, provided by the PaddingExtension extension
Wraps the widget with a Padding widget using the specified EdgeInsets. -
paddingSymmetric(
{double vertical = 0, double horizontal = 0}) → Widget -
Available on Widget, provided by the PaddingExtension extension
Wraps the widget with a Padding widget applying symmetric padding. -
positioned(
{double? top, double? bottom, double? start, double? end, double? width, double? height}) → Widget -
Available on Widget, provided by the PositionedExtension extension
Wraps the widget with a PositionedDirectional widget. -
positionedDirectional(
{required TextDirection textDirection, double? top, double? bottom, double? start, double? end, double? width, double? height}) → Widget -
Available on Widget, provided by the PositionedExtension extension
Wraps the widget with a Positioned.directional widget. -
positionedFill(
{double? top, double? bottom, double? left, double? right}) → Widget -
Available on Widget, provided by the PositionedExtension extension
Wraps the widget with a Positioned.fill widget. -
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, int wrapWidth = 65}) → 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
-
visible(
bool isVisible) → Widget -
Available on Widget, provided by the VisibilityExtension extension
Wraps the widget with a Visibility widget to conditionally show or hide it. -
width(
double width) → Widget -
Available on Widget, provided by the SizedBoxExtension extension
Creates a SizedBox with a specified width.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Properties
- logLevel ↔ CacheManagerLogLevel
-
Get the current log level of the cache manager.
getter/setter pair
Static Methods
-
evictFromCache(
String url, {String? cacheKey, BaseCacheManager? cacheManager, double scale = 1}) → Future< bool> -
Evict an image from both the disk file based caching system of the
BaseCacheManageras the in memory ImageCache of the ImageProvider.urlis used by both the disk and memory cache. The scale is only used to clear the image from the ImageCache.