Not able to insert images in a container

267 views
Skip to first unread message

Nikhil Shrivastava

unread,
Aug 10, 2019, 2:48:07 PM8/10/19
to Flutter Development (flutter-dev)
This is the exception I keep on receiving even though I have created an 'assets' folder and placed im.jpeg in it. I have also added assets: -assets/im.jpeg in pubspec.yaml.
Please help.


I/flutter (13498): ══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE ╞════════════════════════════════════════════════════
I/flutter (13498): The following assertion was thrown resolving an image codec:
I/flutter (13498): Unable to load asset: asset/im.jpg
I/flutter (13498):
I/flutter (13498): When the exception was thrown, this was the stack:
I/flutter (13498): #0      PlatformAssetBundle.load (package:flutter/src/services/asset_bundle.dart:221:7)
I/flutter (13498): <asynchronous suspension>
I/flutter (13498): #1      AssetBundleImageProvider._loadAsync (package:flutter/src/painting/image_provider.dart:464:44)
I/flutter (13498): <asynchronous suspension>
I/flutter (13498): #2      AssetBundleImageProvider.load (package:flutter/src/painting/image_provider.dart:449:14)
I/flutter (13498): #3      ImageProvider.resolve.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:flutter/src/painting/image_provider.dart:316:48)
I/flutter (13498): #4      ImageCache.putIfAbsent (package:flutter/src/painting/image_cache.dart:160:22)
I/flutter (13498): #5      ImageProvider.resolve.<anonymous closure>.<anonymous closure> (package:flutter/src/painting/image_provider.dart:316:25)
I/flutter (13498): (elided 13 frames from package dart:async)
I/flutter (13498):
I/flutter (13498): Image provider: AssetImage(bundle: null, name: "asset/im.jpg")
I/flutter (13498): Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#f3668(), name: "asset/im.jpg", scale:
I/flutter (13498):   1.0)
I/flutter (13498):

Andy Greenshaw

unread,
Aug 10, 2019, 2:53:12 PM8/10/19
to Flutter Development (flutter-dev), Nikhil Shrivastava
Show the lines in pubspec.yaml as the indentation / spaces are important
--
You received this message because you are subscribed to the Google Groups "Flutter Development (flutter-dev)" group.
To unsubscribe from this group and stop receiving emails from it, send an email to flutter-dev...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/flutter-dev/1ca815c8-8d25-45e6-a99e-b8142b70424f%40googlegroups.com.

Kyle Bedell

unread,
Aug 10, 2019, 6:22:47 PM8/10/19
to Flutter Development (flutter-dev)
You probably referenced the image incorrectly. You say the image is im.jpeg, but in your app, you've tried to lookup im.jpg as called out by the error.
Reply all
Reply to author
Forward
0 new messages