1

I requested image from api, some times users haven't employee images. How to set bydefault image If request image null?

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,
      );
    }
  • 3
    Possible duplicate of [Flutter - Default image to Image.network when it fails](https://stackoverflow.com/questions/49771765/flutter-default-image-to-image-network-when-it-fails) – Swift May 15 '19 at 13:28
  • thanks @SwiftingDuster –  May 15 '19 at 14:31

0 Answers0