Manage Beneficiary fetch

This commit is contained in:
2025-08-08 08:40:38 +05:30
parent ae40f61c01
commit 117e2d5786
8 changed files with 146 additions and 5 deletions

View File

@@ -103,5 +103,29 @@ class BeneficiaryService {
return false;
}
}
Future<List<dynamic>> fetchBeneficiaryList() async {
try {
final response = await _dio.get(
"/api/beneficiaries/get", // replace with actual path
options: Options(
headers: {
"Content-Type": "application/json",
},
),
);
if (response.statusCode == 200) {
// Assuming API returns JSON array of beneficiaries
return response.data as List<dynamic>;
} else {
throw Exception("Failed to fetch beneficiaries");
}
} catch (e) {
print("Error fetching beneficiaries: $e");
return [];
}
}
}