You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
17 lines
510 B
17 lines
510 B
import 'dart:async';
|
|
import 'dart:io';
|
|
|
|
import 'package:http/http.dart' as http;
|
|
|
|
/// User-facing message when an API/network request fails.
|
|
String connectionErrorMessage(Object error) {
|
|
if (error is SocketException ||
|
|
error is TimeoutException ||
|
|
error is http.ClientException ||
|
|
error is HandshakeException ||
|
|
error is TlsException) {
|
|
return 'Connection to server has broken. Check API URL and network.';
|
|
}
|
|
return 'Network error. Please check the API URL and try again.';
|
|
}
|