http
http copied to clipboard
SoketException: Se agotó el tiempo de espera del semáforo (Semaphore timeout)
I run the request code inside a try/catch block, but this exception seems to not be catched:
Future<bool> _serverAvailable() async {
try {
final response = await http
.get(Uri.parse(availabilityUrl))
.timeout(const Duration(seconds: 5), onTimeout: () {
return http.Response('Internal 5 seconds timeout', 408);
});
return response.success;
} catch (e) {
return false;
}
}
Maybe it is not a good practice to use Future's timeout with Http client. I now using Dio client with timeout options
Same problem here. Initialized today. ` Future<AllProducts> kidsClothes() async { final records = await pb .collection('products') .getList(filter: 'hay = true && category = "Infantil"');
AllProducts kidPijamas = AllProducts.fromJson(records.toJson());
notifyListeners();
return kidPijamas;
}`
package pocketbase