我从api请求了图片,有时用户没有员工图片。如何设置默认图像如果请求图像为空?
try {
return Image.network(
"$_url/nativeapi/v1.0/s3object/GetEmployeeImage?siteId=${widget
.siteId}&employeeId=${widget.employeeId}",
width: 100.0,
height: 100.0,
);
}
on SocketException catch(e){
return Image.asset(
"assets/images/logo.png",
width: 100.0,
height: 100.0,
);
}