OptimizedImage constructor

const OptimizedImage({
  1. Key? key,
  2. String? assetPath,
  3. String? networkUrl,
  4. Uint8List? bytes,
  5. double? width,
  6. double? height,
  7. BoxFit fit = BoxFit.cover,
  8. int? maxWidth,
  9. int? maxHeight,
  10. Widget? placeholder,
  11. Widget? errorWidget,
  12. Map<String, String>? httpHeaders,
})

Implementation

const OptimizedImage({
  super.key,
  this.assetPath,
  this.networkUrl,
  this.bytes,
  this.width,
  this.height,
  this.fit = BoxFit.cover,
  this.maxWidth,
  this.maxHeight,
  this.placeholder,
  this.errorWidget,
  this.httpHeaders,
}) : assert(
       (assetPath != null ? 1 : 0) +
               (networkUrl != null ? 1 : 0) +
               (bytes != null ? 1 : 0) ==
           1,
       'Provide exactly one of: assetPath, networkUrl, bytes',
     );