Live Objects are supported in the Flutter SDK with Streams and LiveCollection for real-time data synchronization
StreamSubscription<Object>
instance and Live Collection is represented by an instance of LiveCollection
. LiveCollection is a generic class that encapsulates any other object and notifies the observer whenever any property of the encapsulated object changes.
Live Object helps to observe changes in a single object whereas Live Collection helps to observe changes in a list of objects.
StreamSubscription<AmityPost>
for single objects or LiveCollection<AmityMessage>
for collections.StreamSubscription<Object>
is a native flutter class that keeps track of a single object. It is a live object. In Flutter AmitySDK, any object which provides Stream is a Live Object.
This function helps listen to Live Object. Whenever any property for the observed object changes, the listen callback will be triggered.
LiveCollection
is a generic class that keeps track of a collection of objects. It is a Live Collection. In Flutter SDK, any object that is encapsulated by LiveCollection class is a live collection.
asStream
method can get triggered multiple times throughout the lifetime of the application as long as its associated Stream<List<Object>>
is retained in memory.
asStream
method will be called from the main thread so you can perform any UI update-related task within the listen block itself.
loadNext()
method to fetch more data. It also exposes hasNext
property to check if the next page or previous page is present.
reset()
method on the same collection.
Memory Management
Error Handling
Pagination Management
Performance Optimization