removeCowGroup method Null safety
- CowGroup _
소 그룹을 삭제합니다.
Implementation
Future<CowGroup?> removeCowGroup(CowGroup _) async {
LogManager().addLog("removeCowGroup", screen: runtimeType.toString());
try {
await reqDELETE(
path: '/api/cow_groups/${_.id}',
queryParameters: {
"farm_id": farmState.currentFarm!.id,
},
);
if (_ == cowGroupState.currentCowGroup) cowGroupState.changeCurrentGroup(null);
await fetchCows();
return _;
} catch (e) {
LogManager().addLog("removeCowGroup call failed: $e", screen: runtimeType.toString());
return null;
}
}