getGiftList method
Future<TUIActionCallback>
getGiftList(
)
Implementation
Future<TUIActionCallback> getGiftList() async {
final result = await _giftStore.refreshUsableGifts();
if (!result.isSuccess) {
return TUIActionCallback(code: TUIError.fromRawValue(result.errorCode), message: result.errorMessage);
}
final List<GiftCategory> giftCategoryList = _giftStore.giftState.usableGifts.value;
List<Gift> giftList = List.empty(growable: true);
for (final giftCategory in giftCategoryList) {
giftList.addAll(giftCategory.giftList);
}
_updateGiftListMap(roomId, giftList);
return TUIActionCallback(code: TUIError.fromRawValue(result.errorCode), message: result.errorMessage);
}