try {
final request = await client.get(...);
final response = await request.close()
.timeout(const Duration(seconds: 2));
// rest of the code
...
} on TimeoutException catch (_) {
// A timeout occurred.
} on SocketException catch (_) {
// Other exception
}
Thứ Tư, 10 tháng 6, 2020
How to set timeout when connect api in flutter
Đăng ký:
Đăng Nhận xét (Atom)
How to reload app in flutter
Phoenix . rebirth (context);
-
Wrap( children: [ MyWidget(), MyWidget(), MyWidget(), MyWidget(), MyWidget(), ], ),
-
DateTime. parse (json[ 'modified_gmt' ]+ 'Z' as String)
-
FocusScope . of ( context ). requestFocus ( FocusNode ());
Không có nhận xét nào:
Đăng nhận xét