title: How to catch "Unable to load asset: assets/images/sample_img_url.png"
body: <p>Is there any way to catch the &quot;Unable to load asset: assets/images/sample_img_url.png&quot; error in Flutter?</p>
  <p>What I am trying to do is load an asset image by providing its path(from API). But if I do not have an image that associates with the given path, I need to load a sample image.</p>
  <p>I've created a custom placeholder widget as follows. But's it's not working as I expected. anyone can help me with this?</p>
  <pre><code>class ImagePlaceHolder extends StatelessWidget {
    final String path;
    final double width;
  
    const ImagePlaceHolder({Key key, this.path, this.width}) : super(key: key);
    @override
    Widget build(BuildContext context) {
      Image finalImage;
      try{
        finalImage = Image.asset(
            path,
            width: width,
        );
      }
      catch(Exception){
        finalImage = Image.asset(
            &quot;assets/images/app_update_logo.png&quot;,
            width: width,
        );
      }
      return finalImage;
    }
  }
  </code></pre>