onReorderGroups method Null safety

void onReorderGroups(
  1. int oldIndex,
  2. int newIndex
)

소그룹 순서를 변경

Implementation

void onReorderGroups(int oldIndex, int newIndex) async {
  EventService().eventBus.fire(PopupEvent(type: PopupType.loading, action: PopupAction.show));
  if (oldIndex < newIndex) newIndex -= 1;
  final CowGroup group = ApiService().cowGroupState.cowGroups.removeAt(oldIndex);
  ApiService().cowGroupState.cowGroups.insert(newIndex, group);
  ApiService().cowGroupState.notifyListeners();
  await ApiService().updateCowGroups(ApiService().cowGroupState.cowGroups);
  EventService().eventBus.fire(PopupEvent(type: PopupType.loading, action: PopupAction.close));
}