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

@@ -62,4 +62,3 @@ class Beneficiary {
return 'Beneficiary(accountNo: $accountNo, accountType: $accountType, ifscCode: $ifscCode, name: $name)';
}
}

View File

@@ -30,4 +30,3 @@ class Ifsc {
return 'IFSC(ifscCode: $ifscCode, bankName: $bankName, branchName: $branchName)';
}
}

View File

@@ -32,7 +32,7 @@ class TransferResponse {
TransferResponse({
required this.status,
required this.message,
required this.error,
required this.error,
});
factory TransferResponse.fromJson(Map<String, dynamic> json) {
@@ -42,4 +42,4 @@ class TransferResponse {
error: json['error'] as String?,
);
}
}
}

View File

@@ -10,7 +10,7 @@ class AuthRepository {
final AuthService _authService;
final UserService _userService;
final SecureStorage _secureStorage;
static const _accessTokenKey = 'access_token';
static const _tokenExpiryKey = 'token_expiry';
@@ -18,35 +18,37 @@ class AuthRepository {
Future<List<User>> login(String customerNo, String password) async {
// Create credentials and call service
final credentials = AuthCredentials(customerNo: customerNo, password: password);
final credentials =
AuthCredentials(customerNo: customerNo, password: password);
final authToken = await _authService.login(credentials);
// Save token securely
await _saveAuthToken(authToken);
// Get and save user profile
final users = await _userService.getUserDetails();
return users;
}
Future<bool> isLoggedIn() async {
final token = await _getAuthToken();
return token != null && !token.isExpired;
}
Future<String?> getAccessToken() async {
final token = await _getAuthToken();
if (token == null) return null;
return token.accessToken;
}
// Private helper methods
Future<void> _saveAuthToken(AuthToken token) async {
await _secureStorage.write(_accessTokenKey, token.accessToken);
await _secureStorage.write(_tokenExpiryKey, token.expiresAt.toIso8601String());
await _secureStorage.write(
_tokenExpiryKey, token.expiresAt.toIso8601String());
}
Future<AuthToken?> _getAuthToken() async {
final accessToken = await _secureStorage.read(_accessTokenKey);
final expiryString = await _secureStorage.read(_tokenExpiryKey);
@@ -59,4 +61,4 @@ class AuthRepository {
}
return null;
}
}
}

View File

@@ -1,7 +1,6 @@
import 'package:kmobile/data/models/transfer.dart';
import 'package:dio/dio.dart';
abstract class TransferRepository {
Future<TransferResponse> transfer(Transfer transfer);
}
@@ -25,4 +24,4 @@ class TransferRepositoryImpl implements TransferRepository {
return TransferResponse.fromJson(resp.data as Map<String, dynamic>);
}
}
}