我试图从localhost加载flutter移动安卓模拟器中的图像,但它不工作(图像不显示)。
CircleAvatar(
radius: SizerUtil.deviceType == DeviceType.tablet ? 12.w : 13.w,
backgroundColor: kSecondaryColor,
backgroundImage: NetworkImage('https://10.0.2.2:37211/Files/Registeration/Images/42_30092022074513.jpg'),
),
我收到以下错误:
══╡ EXCEPTION CAUGHT BY IMAGE RESOURCE SERVICE
╞════════════════════════════════════════════════════
The following HandshakeException was thrown resolving an image codec:
Handshake error in client (OS Error:
WRONG_VERSION_NUMBER(tls_record.cc:242))
When the exception was thrown, this was the stack:
#0 _SecureFilterImpl._handshake (dart:io-patch/secure_socket_patch.dart:99:46)
#1 _SecureFilterImpl.handshake (dart:io-patch/secure_socket_patch.dart:142:25)
#2 _RawSecureSocket._secureHandshake (dart:io/secure_socket.dart:911:54)
#3 _RawSecureSocket._closeHandler (dart:io/secure_socket.dart:904:15)
#4 _RawSecureSocket._eventDispatcher (dart:io/secure_socket.dart:847:9)
#11 new _RawSocket.<anonymous closure> (dart:io-patch/socket_patch.dart:1846:35)
#12 _NativeSocket.issueReadEvent.issue (dart:io-patch/socket_patch.dart:1315:18)
(elided 8 frames from dart:async)
Image provider: NetworkImage("https://10.0.2.2:37211/Files/Registeration/Images/42_30092022074513.jpg", scale: 1.0)
Image key: NetworkImage("https://10.0.2.2:37211/Files/Registeration/Images/42_30092022074513.jpg", scale: 1.0)
当用来自互联网的URL图像替换图像的链接时,它将正常工作。所以我的假设是,使用本地主机有问题。
Also, when I replace the "10.0.2.2" with "localhost" and run the link on the browser the image will show.
我试过这个question,但它对我不起作用。
有什么建议吗?
2条答案
按热度按时间ulydmbyx1#
Also Visit this
guykilcj2#
我有同样的问题,我解决了它把我的电脑的ip地址。
它适用于我的android设备和模拟器