formatted all files.

This commit is contained in:
Faris Armoush
2025-06-12 15:33:32 +03:00
parent 29959f567e
commit 04250ebc98
474 changed files with 5425 additions and 4338 deletions

View File

@ -17,34 +17,34 @@ class ServerFailure extends Failure {
factory ServerFailure.fromDioError(DioException dioError) {
switch (dioError.type) {
case DioExceptionType.connectionTimeout:
return ServerFailure("Connection timeout with the Server.");
return ServerFailure('Connection timeout with the Server.');
case DioExceptionType.sendTimeout:
return ServerFailure("Send timeout with the Server.");
return ServerFailure('Send timeout with the Server.');
case DioExceptionType.receiveTimeout:
return ServerFailure("Receive timeout with the Server.");
return ServerFailure('Receive timeout with the Server.');
case DioExceptionType.badCertificate:
return ServerFailure("Bad certificate!");
return ServerFailure('Bad certificate!');
case DioExceptionType.badResponse:
{
// var document = parser.parse(dioError.response!.data.toString());
// var message = document.body!.text;
return ServerFailure.fromResponse(dioError.response!.statusCode!,
dioError.response?.data['message'] ?? "Error");
return ServerFailure.fromResponse(dioError.response!.statusCode,
dioError.response?.data['message'] ?? 'Error');
}
case DioExceptionType.cancel:
return ServerFailure("The request to ApiServer was canceled");
return ServerFailure('The request to ApiServer was canceled');
case DioExceptionType.connectionError:
return ServerFailure("No Internet Connection");
return ServerFailure('No Internet Connection');
case DioExceptionType.unknown:
return ServerFailure("Unexpected Error, Please try again!");
return ServerFailure('Unexpected Error, Please try again!');
default:
return ServerFailure("Unexpected Error, Please try again!");
return ServerFailure('Unexpected Error, Please try again!');
}
}
@ -54,9 +54,9 @@ class ServerFailure extends Failure {
case 403:
return ServerFailure(responseMessage);
case 400:
List<String> errors = [];
final errors = <String>[];
if (responseMessage is List) {
for (var error in responseMessage) {
for (final error in responseMessage) {
errors.add(error);
}
} else {
@ -64,11 +64,11 @@ class ServerFailure extends Failure {
}
return ServerFailure(errors.join('\n'));
case 404:
return ServerFailure("");
return ServerFailure('');
case 500:
return ServerFailure(responseMessage);
default:
return ServerFailure("Opps there was an Error, Please try again!");
return ServerFailure('Opps there was an Error, Please try again!');
}
}
}