Exception caught by image resource service The following assertion was thrown resolving an image codec: Unable to load asset: images/levender.jpg

Exception caught by image resource service

(
        height: 300,
        width: double.maxFinite,
        child: TabBarView(controller: _tabController, children: [
          ListView.builder(
            itemCount: 3,
            itemBuilder: (BuildContext context, int index) {
              return Container(
                width: 200,
                height: 300,
                decoration: BoxDecoration(
                  borderRadius: BorderRadius.circular(20),
                  color: Colors.white,
                  image: DecorationImage(
                    image: AssetImage(
                      "images/levender.jpg",
                    ),
                    fit: BoxFit.cover,
                  ),
                ),
              );

When the exception was thrown, this was the stack C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/internal/js_dev_runtime/private/ddc_runtime/errors.dart 236:49 throw packages/flutter/src/services/asset_bundle.dart 224:55 load C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/_internal/js_dev_runtime/patch/async_patch.dart 45:50 C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1362:47 _rootRunUnary C:/b/s/w/ir/cache/builder/src/out/host_debug/dart-sdk/lib/async/zone.dart 1265:19 runUnary ... Image provider: AssetImage(bundle: null, name: "images/levender.jpg") Image key: AssetBundleImageKey(bundle: PlatformAssetBundle#0645c(), name: "images/levender.jpg", scale: 1)

Upvotes: 0

Views: 1461

Answers (1)

Navid Shokoufeh
Navid Shokoufeh

Reputation: 569

It will happen sometimes. sometimes when you add an asset if this error happened just close your emulator and run it again and it will be ok.

Upvotes: 0

Related Questions