GiftStore class abstract

Gift-related interface, managing gift sending, gift state synchronization, and gift event listening in live rooms/voice chat rooms.

GiftStore Gift management class for handling gift-related business logic in live rooms/voice chat rooms. GiftStore provides a complete set of gift management APIs, including sending gifts, refreshing gift lists, setting language, and listening to gift events. Through this class, gift interaction features can be implemented in live rooms.

Key Features

  • Gift Sending:Support sending specified gifts to the current room
  • Gift List:Get and refresh the available gift list in the current room
  • Language Setting:Set the display language for gift information
  • Event Listening:Listen to gift receiving events

Important: Use the GiftStore.create factory method to create a GiftStore instance, passing a valid live room ID.

Note: Gift state updates are delivered through the giftState publisher. Subscribe to it to receive real-time updates of gift data in the room.

Gift Operations Overview

Feature Method Description
Create Instance GiftStore.create Create a gift management instance for the specified room
Send Gift sendGift Send a specified gift to the current room
Refresh List refreshUsableGifts Manually refresh the available gift list in the current room
Language Setting setLanguage Set the display language for gift information
Event Listening addGiftListener/removeGiftListener Add/remove gift event listeners

Topics

Creating Instance

Observing State and Events

Gift Operations

See Also

Constructors

GiftStore()

Properties

giftState GiftState
Gift state subscription for the current room, containing information such as available gift list. By subscribing to this state, real-time updates of gift data in the room can be obtained.
no setter
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

addGiftListener(GiftListener listener) → void
Gift event publisher. Through this publisher, you can subscribe to/remove gift events in live rooms/voice chat rooms. After subscribing, you will receive corresponding notifications when viewers send gifts.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
refreshUsableGifts() Future<CompletionHandler>
Manually refresh the available gift list in the current room.
removeGiftListener(GiftListener listener) → void
sendGift({required String giftID, required int count}) Future<CompletionHandler>
Send a specified gift to the current room
setLanguage(String language) → void
Set the display language for gift information.
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

create(String liveID) GiftStore
Create gift management instance.