iiitv / iiitv/DonorConnect-Debugathon
[Bug]: Add Error Handling for Empty Records in BloodBankService (blood_bank_service.dart)
Nobody has claimed this yet.
- Dominant language
- Dart
- Stars
- 1
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
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.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open blood_bank_service.dart and find the getBloodBanks method. Inspect how the API response is read, especially data['records'], then exercise responses where records is missing, null, or empty. Done means these cases return an appropriate response or empty list without causing a runtime error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- dart
- Domain
- api
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 55/100