FadeInImage.memoryNetwork constructor

  1. {Key? key,
  2. required Uint8List placeholder,
  3. ImageErrorWidgetBuilder? placeholderErrorBuilder,
  4. required String image,
  5. ImageErrorWidgetBuilder? imageErrorBuilder,
  6. double placeholderScale = 1.0,
  7. double imageScale = 1.0,
  8. bool excludeFromSemantics = false,
  9. String? imageSemanticLabel,
  10. Duration fadeOutDuration = const Duration(milliseconds: 300),
  11. Curve fadeOutCurve = Curves.easeOut,
  12. Duration fadeInDuration = const Duration(milliseconds: 700),
  13. Curve fadeInCurve = Curves.easeIn,
  14. double? width,
  15. double? height,
  16. BoxFit? fit,
  17. Color? color,
  18. BlendMode? colorBlendMode,
  19. Color? placeholderColor,
  20. BlendMode? placeholderColorBlendMode,
  21. BoxFit? placeholderFit,
  22. FilterQuality filterQuality = FilterQuality.low,
  23. FilterQuality? placeholderFilterQuality,
  24. AlignmentGeometry alignment = Alignment.center,
  25. ImageRepeat repeat = ImageRepeat.noRepeat,
  26. bool matchTextDirection = false,
  27. int? placeholderCacheWidth,
  28. int? placeholderCacheHeight,
  29. int? imageCacheWidth,
  30. int? imageCacheHeight}

Creates a widget that uses a placeholder image stored in memory while loading the final image from the network.

The placeholder argument contains the bytes of the in-memory image.

The image argument is the URL of the final image.

The placeholderScale and imageScale arguments are passed to their respective ImageProviders (see also ImageInfo.scale).

If placeholderCacheWidth, placeholderCacheHeight, imageCacheWidth, or imageCacheHeight are provided, it indicates to the engine that the respective image should be decoded at the specified size. The image will be rendered to the constraints of the layout or width and height regardless of these parameters. These parameters are primarily intended to reduce the memory usage of ImageCache.

The placeholder, image, placeholderScale, imageScale, fadeOutDuration, fadeOutCurve, fadeInDuration, fadeInCurve, alignment, repeat, and matchTextDirection arguments must not be null.

See also:

  • Image.memory, which has more details about loading images from memory.
  • Image.network, which has more details about loading images from the network.


  required Uint8List placeholder,
  required String image,
  double placeholderScale = 1.0,
  double imageScale = 1.0,
  this.excludeFromSemantics = false,
  this.fadeOutDuration = const Duration(milliseconds: 300),
  this.fadeOutCurve = Curves.easeOut,
  this.fadeInDuration = const Duration(milliseconds: 700),
  this.fadeInCurve = Curves.easeIn,
  this.filterQuality = FilterQuality.low,
  this.alignment = Alignment.center,
  this.repeat = ImageRepeat.noRepeat,
  this.matchTextDirection = false,
  int? placeholderCacheWidth,
  int? placeholderCacheHeight,
  int? imageCacheWidth,
  int? imageCacheHeight,
}) : placeholder = ResizeImage.resizeIfNeeded(placeholderCacheWidth, placeholderCacheHeight, MemoryImage(placeholder, scale: placeholderScale)),
     image = ResizeImage.resizeIfNeeded(imageCacheWidth, imageCacheHeight, NetworkImage(image, scale: imageScale));