formatted the whole codebase

This commit is contained in:
asif
2025-08-18 03:20:05 +05:30
parent e2a809d363
commit e6ea764785
58 changed files with 470 additions and 373 deletions

View File

@@ -4,7 +4,6 @@ import '../../features/auth/models/auth_token.dart';
import '../../features/auth/models/auth_credentials.dart';
import '../../core/errors/exceptions.dart';
class AuthService {
final Dio _dio;
AuthService(this._dio);
@@ -15,7 +14,7 @@ class AuthService {
'/api/auth/login',
data: credentials.toJson(),
);
if (response.statusCode == 200) {
return AuthToken.fromJson(response.data);
} else {
@@ -30,7 +29,8 @@ class AuthService {
}
throw NetworkException('Network error during login');
} catch (e) {
throw UnexpectedException('Unexpected error during login: ${e.toString()}');
throw UnexpectedException(
'Unexpected error during login: ${e.toString()}');
}
}
@@ -40,7 +40,7 @@ class AuthService {
'/auth/refresh',
data: {'refresh_token': refreshToken},
);
if (response.statusCode == 200) {
return AuthToken.fromJson(response.data);
} else {
@@ -54,7 +54,7 @@ class AuthService {
Future<bool> checkTpin() async {
try {
final response = await _dio.get('/api/auth/tpin');
if (response.statusCode == 200) {
return response.data['tpinSet'] as bool;
} else {
@@ -66,7 +66,8 @@ class AuthService {
}
throw NetworkException('Network error during TPIN check');
} catch (e) {
throw UnexpectedException('Unexpected error during TPIN check: ${e.toString()}');
throw UnexpectedException(
'Unexpected error during TPIN check: ${e.toString()}');
}
}
@@ -76,7 +77,7 @@ class AuthService {
'/api/auth/tpin',
data: {'tpin': tpin},
);
if (response.statusCode != 200) {
throw AuthException('Failed to set TPIN');
}
@@ -86,8 +87,8 @@ class AuthService {
}
throw NetworkException('Network error during TPIN setup');
} catch (e) {
throw UnexpectedException('Unexpected error during TPIN setup: ${e.toString()}');
throw UnexpectedException(
'Unexpected error during TPIN setup: ${e.toString()}');
}
}
}
}

View File

@@ -22,8 +22,8 @@ class RtgsService {
throw Exception(
'RTGS transaction failed with status code: ${response.statusCode}');
}
} on DioException {
rethrow ;
} on DioException {
rethrow;
} catch (e) {
throw Exception('An unexpected error occurred: ${e.toString()}');
}

View File

@@ -7,7 +7,8 @@ class NeftService {
NeftService(this._dio);
Future<NeftResponse> processNeftTransaction(NeftTransaction transaction) async {
Future<NeftResponse> processNeftTransaction(
NeftTransaction transaction) async {
try {
await Future.delayed(const Duration(seconds: 3));
final response = await _dio.post(

View File

@@ -11,7 +11,7 @@ class PaymentService {
Future<PaymentResponse> processQuickPayWithinBank(Transfer transfer) async {
try {
await Future.delayed(const Duration(seconds: 3)); // Simulate delay
await _dio.post('/api/payment/transfer', data: transfer.toJson());
return PaymentResponse(

View File

@@ -22,8 +22,8 @@ class RtgsService {
throw Exception(
'RTGS transaction failed with status code: ${response.statusCode}');
}
} on DioException {
rethrow ;
} on DioException {
rethrow;
} catch (e) {
throw Exception('An unexpected error occurred: ${e.toString()}');
}

View File

@@ -28,4 +28,4 @@ class UserService {
throw Exception('Unexpected error: ${e.toString()}');
}
}
}
}