Skip to content

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

@PadmnabhTewari

Description

@PadmnabhTewari

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions