ImageView constructor

const ImageView({
  1. Key? key,
  2. required Future<String> url,
  3. Duration? fadeOutDuration = const Duration(milliseconds: 250),
  4. ImageStyle style = const ImageStyle(),
  5. String? thumbHash,
  6. String? blurHash,
  7. String? cacheKey,
})

Creates an ImageView widget for asynchronous image loading with placeholders.

The required url Future resolves to the image source, enabling dynamic loading (e.g., from API). Provide thumbHash or blurHash for instant previews during network delays. style applies display configurations like fit and blending. fadeOutDuration controls the transition animation from placeholder to image, defaulting to 250ms for subtle changes. cacheKey enables custom caching to prevent redundant downloads.

Initialization sets up the state for efficient handling of loading, error, and success states.

Implementation

const ImageView(
    {super.key,
    required this.url,
    this.fadeOutDuration = const Duration(milliseconds: 250),
    this.style = const ImageStyle(),
    this.thumbHash,
    this.blurHash,
    this.cacheKey});