getGiftList method

Future<TUIActionCallback> getGiftList()

Implementation

Future<TUIActionCallback> getGiftList() async {
  final result = await _giftManager.getGiftList(roomId);
  if (result.code != TUIError.success || result.data == null) {
    return TUIActionCallback(code: result.code, message: result.message);
  }
  final List<TUIGiftCategory> giftCategoryList = result.data!;
  List<TUIGiftInfo> giftList = List.empty(growable: true);
  for (final giftCategory in giftCategoryList) {
    giftList.addAll(giftCategory.giftList);
  }
  _updateGiftListMap(roomId, giftList);

  return TUIActionCallback(code: result.code, message: result.message);
}