title: Testing if an asset image exists, and falling back to a network image
body: <p>I have the following function that attempts to load an image asset, falling back to loading it over the network if it doesn't exist:</p>
  
  <pre><code>Widget loadSvgWithFallbackToCdn(String path,
        {double width, double height, Function placeholderBuilder}) {
      try {
        return SvgPicture.asset(
          path,
          height: height,
          width: width,
          placeholderBuilder: placeholderBuilder,
        );
      } catch(e) {
        return SvgPicture.network(
          '$CDN_URL/$path',
          height: height,
          width: width,
          placeholderBuilder: placeholderBuilder,
        );
      }
    }
  </code></pre>
  
  <p>The issue is that the resulting "Unable to load asset" exception is not processed by the <code>catch(e)</code> block:</p>
  
  <p><a href="https://i.stack.imgur.com/s0Ums.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/s0Ums.png" alt="exception outside catch(e) block"></a></p>
  
  <p>How can I handle missing asset images gracefully (seamlessly falling back to a CDN hosted image)?</p>