0

I'm trying to display an image in a list, but it times out after the image loads. I tried other domain pictures without this problem. It only happens when loading multiple images. Can someone help me to figure out what's going on?

here is the error:

The following SocketException was thrown resolving an image codec:
Operation timed out (OS Error: Operation timed out, errno = 60), address = shop.edathemepark.com.tw,
port = 59820


        When the exception was thrown, this was the stack:
        #0      _NativeSocket.startConnect (dart:io-patch/socket_patch.dart:719:35)
        #1      _RawSocket.startConnect (dart:io-patch/socket_patch.dart:1877:26)
        #2      RawSocket.startConnect (dart:io-patch/socket_patch.dart:27:23)
        #3      RawSecureSocket.startConnect (dart:io/secure_socket.dart:297:22)
        #4      SecureSocket.startConnect (dart:io/secure_socket.dart:77:28)
        #5      _ConnectionTarget.connect (dart:_http/http_impl.dart:2482:26)
        #6      _HttpClient._getConnection.connect (dart:_http/http_impl.dart:2924:12)
        #7      _HttpClient._getConnection (dart:_http/http_impl.dart:2929:12)
        #8      _HttpClient._openUrl (dart:_http/http_impl.dart:2784:12)
        #9      _HttpClient.getUrl (dart:_http/http_impl.dart:2627:48)
        #10     NetworkImage._loadAsync (package:flutter/src/painting/_network_image_io.dart:124:59)
        #11     NetworkImage.loadImage (package:flutter/src/painting/_network_image_io.dart:84:14)

here is my sample code:

Column(
  children: <Widget>[
    //it shows good
    /*
    Image.network('https://picsum.photos/250?image=9'),
    Image.network('https://picsum.photos/250?image=8'),
    Image.network('https://picsum.photos/250?image=7'),
    Image.network('https://picsum.photos/250?image=6'),
    Image.network('https://picsum.photos/250?image=5'),*/
    
    //high probability error on iphone, 100% error on chrome
    /*
    Image.network("https://shop.edathemepark.com.tw/Upload/EasyGo2/Notify/F8306493-E81D-44E4-80AD-5B6D77BA6096.jpg"),
    Image.network("https://shop.edathemepark.com.tw/Upload/EasyGo2/Notify/E41B7C25-4166-4716-95C2-0DC0ECE740A8.jpg"),
    Image.network("https://shop.edathemepark.com.tw/Upload/EasyGo2/Notify/E0A1F5AC-2156-4FD0-B83C-07C882DCE5F4.jpg"),
    */

    //low probability error on iphone, 100% error on chrome
    /*
    Image.network("https://shop.edamall.com.tw/Upload/EasyGo2/Notify/F8306493-E81D-44E4-80AD-5B6D77BA6096.jpg"),
    Image.network("https://shop.edamall.com.tw/Upload/EasyGo2/Notify/E41B7C25-4166-4716-95C2-0DC0ECE740A8.jpg"),
    Image.network("https://shop.edamall.com.tw/Upload/EasyGo2/Notify/E0A1F5AC-2156-4FD0-B83C-07C882DCE5F4.jpg"),
    */
  ],
),
doneforaiur
  • 1,308
  • 7
  • 14
  • 21
Leo Chen
  • 327
  • 1
  • 8
  • It is likely caused by your internet connection speed. Could you try implementing [this](https://stackoverflow.com/a/76147468/8658598) to confirm that it loads but it loads slowly? – doneforaiur Jul 17 '23 at 04:42
  • It causes timeout for all internet work including api. So just showing CircularProgressIndicator doesn't work for me. – Leo Chen Jul 17 '23 at 05:18
  • I need to know what going on to tell mine MIS fix it. – Leo Chen Jul 17 '23 at 05:20
  • My suggested answer doesn't just show a progress indicator. It also shows if the data is being loaded. You could also just print `loadingProgress.cumulativeBytesLoaded`. I'm just trying to eliminate the posilibity of bad connection speeds... – doneforaiur Jul 17 '23 at 05:54
  • One of picture, ImageChunkEvent is null until timeout. – Leo Chen Jul 17 '23 at 06:31
  • It can't even establish a connection, as it timeouts on this; `_NativeSocket.startConnect`. What is your flutter version? – doneforaiur Jul 17 '23 at 06:56
  • [✓] Flutter (Channel stable, 3.10.5, on macOS 13.2.1 22D68 darwin-arm64, locale zh-Hant-TW) [✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0) [✓] Xcode - develop for iOS and macOS (Xcode 14.2) [✓] Chrome - develop for the web [✓] Android Studio (version 2022.2) – Leo Chen Jul 17 '23 at 07:45
  • When i load more picture,it more high probability hapaned. – Leo Chen Jul 17 '23 at 08:02

0 Answers0