OptimizedImage constructor

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

Implementation

const OptimizedImage({
  super.key,
  this.assetPath,
  this.networkUrl,
  this.filePath,
  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) +
               (filePath != null ? 1 : 0) +
               (bytes != null ? 1 : 0) ==
           1,
       'Provide exactly one of: assetPath, networkUrl, filePath, bytes',
     );