imageProviderWidget function Null safety

ImageProvider<Object>? imageProviderWidget(
  1. {String? imageUrl,
  2. Uint8List? imageMemory,
  3. String? imageAsset,
  4. String? assetPlaceHolder}
)

Implementation

ImageProvider? imageProviderWidget({
  String? imageUrl,
  Uint8List? imageMemory,
  String? imageAsset,
  String? assetPlaceHolder,
}) {
  if (imageMemory != null && imageMemory.isNotEmpty) {
    return MemoryImage(imageMemory);
  } else if (imageUrl != null && imageUrl.isNotEmpty) {
    return CachedNetworkImageProvider(imageUrl);
  } else if (imageAsset != null && imageAsset.isNotEmpty) {
    return AssetImage(imageAsset);
  } else if (assetPlaceHolder != null && assetPlaceHolder.isNotEmpty) {
    return AssetImage(assetPlaceHolder);
  } else {
    return null;
  }
}