title: Flutter: Unable to load asset
body: <p>I cant Upload image as a background to a container, i have added the image in assets folder and added it to pubspec.yaml and showing me that error :</p>
  
  <pre><code>I/flutter ( 6664): ══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
  I/flutter ( 6664): The following assertion was thrown resolving an image codec:
  I/flutter ( 6664): Unable to load asset: assets/images/img.png
  I/flutter ( 6664): 
  I/flutter ( 6664): When the exception was thrown, this was the stack:
  I/flutter ( 6664): #0      PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:221:7)
  I/flutter ( 6664): &lt;asynchronous suspension&gt;
  I/flutter ( 6664): #1      AssetBundleImageProvider._loadAsync (package:flutter/src/painting/image_provider.dart:484:44)
  I/flutter ( 6664): #2      AssetBundleImageProvider.load (package:flutter/src/painting/image_provider.dart:469:14)
  I/flutter ( 6664): #3      ImageProvider.resolve.&lt;anonymous closure&gt;.&lt;anonymous closure&gt;.&lt;anonymous closure&gt; (package:flutter/src/painting/image_provider.dart:327:17)
  I/flutter ( 6664): #4      ImageCache.putIfAbsent (package:flutter/src/painting/image_cache.dart:160:22)
  I/flutter ( 6664): #5      ImageProvider.resolve.&lt;anonymous closure&gt;.&lt;anonymous closure&gt; (package:flutter/src/painting/image_provider.dart:325:84)
  I/flutter ( 6664): (elided 13 frames from package dart:async)
  I/flutter ( 6664): 
  I/flutter ( 6664): Image provider: AssetImage(bundle: null, name: "assets/images/img.png")
  I/flutter ( 6664): Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#99877(), name: "assets/images/img.png",
  I/flutter ( 6664):   scale: 1.0)
  I/flutter ( 6664): ════════════════════════════════════════════════════════════════════════════════════════════════════
  </code></pre>
  
  <p>code :</p>
  
  <pre><code>body: Form(
            child: Column(
              children: &lt;Widget&gt;[
                 Container(
                   decoration: BoxDecoration(
                     image: DecorationImage(
                       image: AssetImage("assets/images/img.png"),
                       fit: BoxFit.cover,
                     ),
                   ),
  </code></pre>
  
  <p>I have added</p>
  
  <pre><code>assets:
    - assets/images/
  </code></pre>
  
  <p>to pubspec.yaml</p>
  
  <p>the image folder</p>
  
  <p><a href="https://i.stack.imgur.com/EuX5u.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/EuX5u.png" alt="the image folder"></a></p>
  
  <p>and at</p>
  
  <pre><code>assets:
    - assets/images/img.png
  </code></pre>
  
  <hr>
  
  <pre><code>I/flutter ( 6664): ══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
  I/flutter ( 6664): The following assertion was thrown resolving an image codec:
  I/flutter ( 6664): Unable to load asset: assets/images/img.png
  I/flutter ( 6664): 
  I/flutter ( 6664): When the exception was thrown, this was the stack:
  I/flutter ( 6664): #0      PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:221:7)
  I/flutter ( 6664): &lt;asynchronous suspension&gt;
  I/flutter ( 6664): #1      AssetBundleImageProvider._loadAsync (package:flutter/src/painting/image_provider.dart:484:44)
  I/flutter ( 6664): #2      AssetBundleImageProvider.load (package:flutter/src/painting/image_provider.dart:469:14)
  I/flutter ( 6664): #3      ImageProvider.resolve.&lt;anonymous closure&gt;.&lt;anonymous closure&gt;.&lt;anonymous closure&gt; (package:flutter/src/painting/image_provider.dart:327:17)
  I/flutter ( 6664): #4      ImageCache.putIfAbsent (package:flutter/src/painting/image_cache.dart:160:22)
  I/flutter ( 6664): #5      ImageProvider.resolve.&lt;anonymous closure&gt;.&lt;anonymous closure&gt; (package:flutter/src/painting/image_provider.dart:325:84)
  I/flutter ( 6664): (elided 13 frames from package dart:async)
  I/flutter ( 6664): 
  I/flutter ( 6664): Image provider: AssetImage(bundle: null, name: "assets/images/img.png")
  I/flutter ( 6664): Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#c1182(), name: "assets/images/img.png",
  I/flutter ( 6664):   scale: 1.0)
  I/flutter ( 6664): ════════════════════════════════════════════════════════════════════════════════════════════════════
  </code></pre>