Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Add Error Handling for Empty Records in BloodBankService (blood_bank_service.dart) #4

Open
PadmnabhTewari opened this issue Nov 17, 2024 · 0 comments
Labels

Comments

@PadmnabhTewari
Copy link
Collaborator

PadmnabhTewari commented Nov 17, 2024

Describe the bug

The getBloodBanks method in BloodBankService does not currently handle the case where the API response contains no records or the records field is missing. This could lead to runtime errors or unexpected behavior when the response body is not as expected.

Expected behavior

Without proper error handling, the application may crash or behave unexpectedly if the API response structure changes or if no records are returned.
Add a check to handle cases where data['records'] is null or empty.
Return an appropriate response or an empty list when no records are found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant