Skip to content

Commit

Permalink
Code review suggestions - Moving state to the finally block
Browse files Browse the repository at this point in the history
  • Loading branch information
gabrielbmoro committed Feb 4, 2024
1 parent 4111651 commit c781b91
Showing 1 changed file with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,15 @@ abstract class AddPowerBillBase with Store {
);
uiState = AddPowerBillUIState(isLoading: true);

bool result = false;
try {
bool result = await savePowerBillUseCase.invoke(powerBill);
uiState = AddPowerBillUIState(isLoading: false);
return result;
result = await savePowerBillUseCase.invoke(powerBill);
} catch (error) {
result = false;
} finally {
uiState = AddPowerBillUIState(isLoading: false);
return false;
}

return result;
}
}

0 comments on commit c781b91

Please sign in to comment.