clud features
This commit is contained in:
@@ -0,0 +1,16 @@
|
||||
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.';
|
||||
}
|
||||
Reference in New Issue
Block a user