'Flutter: EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE

When I use Network Image, it's show me render error like this. error :

══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE
╞════════════════════════════════════════════════════
The following ArgumentError was thrown resolving an image codec:
Invalid argument(s): No host specified in URI file:///null

When the exception was thrown, this was the stack:
#0      _HttpClient._openUrl (dart:_http/http_impl.dart:2694:9)
#1      _HttpClient.getUrl (dart:_http/http_impl.dart:2596:48)
#2      NetworkImage._loadAsync
(package:flutter/src/painting/_network_image_io.dart:86:59)
#3      NetworkImage.load
(package:flutter/src/painting/_network_image_io.dart:49:14)
#4      ImageProvider.resolveStreamForKey.<anonymous closure>
(package:flutter/src/painting/image_provider.dart:488:13)
#5      ImageCache.putIfAbsent
(package:flutter/src/painting/image_cache.dart:379:22)
#6      ImageProvider.resolveStreamForKey
(package:flutter/src/painting/image_provider.dart:486:81)
#7      ScrollAwareImageProvider.resolveStreamForKey
(package:flutter/src/widgets/scroll_aware_image_provider.dart:106:19)
#8      ImageProvider.resolve.<anonymous closure>
(package:flutter/src/painting/image_provider.dart:333:9)
#9      ImageProvider._createErrorHandlerAndKey.<anonymous closure>
(package:flutter/src/painting/image_provider.dart:448:24)
#10     SynchronousFuture.then
(package:flutter/src/foundation/synchronous_future.dart:41:35)
#11     ImageProvider._createErrorHandlerAndKey
(package:flutter/src/painting/image_provider.dart:445:9)
#12     ImageProvider.resolve
(package:flutter/src/painting/image_provider.dart:330:5)
#13     _ImageState._resolveImage (package:flutter/src/widgets/image.dart:1119:16)
#14     _ImageState.didChangeDependencies
(package:flutter/src/widgets/image.dart:1071:5)
#15     StatefulElement._firstBuild
(package:flutter/src/widgets/framework.dart:4963:11)
#16     ComponentElement.mount (package:flutter/src/widgets/framework.dart:4781:5)
...     Normal element mounting (48 frames)
#64     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3817:16)
#65     MultiChildRenderObjectElement.inflateWidget
(package:flutter/src/widgets/framework.dart:6350:36)
#66     MultiChildRenderObjectElement.mount
(package:flutter/src/widgets/framework.dart:6362:32)
...     Normal element mounting (27 frames)
#93     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3817:16)
#94     MultiChildRenderObjectElement.inflateWidget
(package:flutter/src/widgets/framework.dart:6350:36)
#95     MultiChildRenderObjectElement.mount
(package:flutter/src/widgets/framework.dart:6362:32)
...     Normal element mounting (114 frames)
#209    Element.inflateWidget (package:flutter/src/widgets/framework.dart:3817:16)
#210    MultiChildRenderObjectElement.inflateWidget
(package:flutter/src/widgets/framework.dart:6350:36)
#211    MultiChildRenderObjectElement.mount
(package:flutter/src/widgets/framework.dart:6362:32)
...     Normal element mounting (9 frames)
#220    Element.inflateWidget (package:flutter/src/widgets/framework.dart:3817:16)
#221    MultiChildRenderObjectElement.inflateWidget
(package:flutter/src/widgets/framework.dart:6350:36)
#222    MultiChildRenderObjectElement.mount
(package:flutter/src/widgets/framework.dart:6362:32)
...     Normal element mounting (175 frames)
#397    Element.inflateWidget (package:flutter/src/widgets/framework.dart:3817:16)
#398    MultiChildRenderObjectElement.inflateWidget
(package:flutter/src/widgets/framework.dart:6350:36)
#399    Element.updateChild (package:flutter/src/widgets/framework.dart:3551:18)
#400    RenderObjectElement.updateChildren
(package:flutter/src/widgets/framework.dart:5883:32)
#401    MultiChildRenderObjectElement.update
(package:flutter/src/widgets/framework.dart:6375:17)
#402    Element.updateChild (package:flutter/src/widgets/framework.dart:3530:15)
#403    ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:4832:16)
#404    StatefulElement.performRebuild
(package:flutter/src/widgets/framework.dart:4977:11)
#405    Element.rebuild (package:flutter/src/widgets/framework.dart:4529:5)
#406    StatefulElement.update (package:flutter/src/widgets/framework.dart:5009:5)
#407    Element.updateChild (package:flutter/src/widgets/framework.dart:3530:15)
#408    ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:4832:16)
#409    Element.rebuild (package:flutter/src/widgets/framework.dart:4529:5)
#410    ProxyElement.update (package:flutter/src/widgets/framework.dart:5154:5)
#411    Element.updateChild (package:flutter/src/widgets/framework.dart:3530:15)
#412    ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:4832:16)
#413    Element.rebuild (package:flutter/src/widgets/framework.dart:4529:5)
#414    ProxyElement.update (package:flutter/src/widgets/framework.dart:5154:5)
#415    _InheritedNotifierElement.update
(package:flutter/src/widgets/inherited_notifier.dart:108:11)
#416    Element.updateChild (package:flutter/src/widgets/framework.dart:3530:15)
#417    SingleChildRenderObjectElement.update
(package:flutter/src/widgets/framework.dart:6222:14)
#418    Element.updateChild (package:flutter/src/widgets/framework.dart:3530:15)
#419    ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:4832:16)
#420    StatefulElement.performRebuild
(package:flutter/src/widgets/framework.dart:4977:11)
#421    Element.rebuild (package:flutter/src/widgets/framework.dart:4529:5)
#422    StatefulElement.update (package:flutter/src/widgets/framework.dart:5009:5)
#423    Element.updateChild (package:flutter/src/widgets/framework.dart:3530:15)
#424    SingleChildRenderObjectElement.update
(package:flutter/src/widgets/framework.dart:6222:14)
#425    Element.updateChild (package:flutter/src/widgets/framework.dart:3530:15)
#426    SingleChildRenderObjectElement.update
(package:flutter/src/widgets/framework.dart:6222:14)
#427    Element.updateChild (package:flutter/src/widgets/framework.dart:3530:15)
#428    ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:4832:16)
#429    Element.rebuild (package:flutter/src/widgets/framework.dart:4529:5)
#430    ProxyElement.update (package:flutter/src/widgets/framework.dart:5154:5)
#431    Element.updateChild (package:flutter/src/widgets/framework.dart:3530:15)
#432    ComponentElement.performRebuild
(package:flutter/src/widgets/framework.dart:4832:16)
#433    StatefulElement.performRebuild
(package:flutter/src/widgets/framework.dart:4977:11)
#434    Element.rebuild (package:flutter/src/widgets/framework.dart:4529:5)
#435    BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2659:19)
#436    WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:891:21)
#437    RendererBinding._handlePersistentFrameCallback
(package:flutter/src/rendering/binding.dart:370:5)
#438    SchedulerBinding._invokeFrameCallback
(package:flutter/src/scheduler/binding.dart:1146:15)
#439    SchedulerBinding.handleDrawFrame
(package:flutter/src/scheduler/binding.dart:1083:9)
#440    SchedulerBinding._handleDrawFrame
(package:flutter/src/scheduler/binding.dart:997:5)
#444    _invoke (dart:ui/hooks.dart:151:10)
#445    PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:308:5)
#446    _drawFrame (dart:ui/hooks.dart:115:31)
(elided 3 frames from dart:async)

Image provider: NetworkImage("null", scale: 1.0)
Image key: NetworkImage("null", scale: 1.0)
═══════════════════════════════════════════════════════════════════════════════════
═════════════════

code:

CircleAvatar(
                radius: 42,
                child: Image.network(
                  "${packageCtrl.packageDetails.value!.logo}",
                  fit: BoxFit.cover,
                  loadingBuilder: (BuildContext ctx, Widget child,
                      ImageChunkEvent? loadingProgress) {
                    if (loadingProgress == null) {
                      return child;
                    } else {
                      return const Center(
                        child: CircularProgressIndicator(
                          valueColor:
                              AlwaysStoppedAnimation<Color>(Colors.green),
                        ),
                      );
                    }
                  },
                ),
              ),

I face this problem after update flutter to 3.0. It's displayed image in debug and release mode

enter image description here

How can I solve this problem ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source