The Amity SDK provides a functionality that allows you to work with social features in your application, including the ability to retrieve a post. In this section, we'll explore how to use the Amity SDK to retrieve a single post from your application. By using a specific function provided by the SDK, you can retrieve a post based on its ID, which provides a convenient way to access specific post data. The retrieved result is returned as a live object of a post. For more information on live objects, please refer to Live Objects/Collections.
Version 6
Beta (v0.0.1)
You can use the getPost()
method to get a single post. You need to pass the postId
of the requested post as the parameter.
In order to get live update from any changes or bind with StreamBuilder
widget, you can alternatively use AmityPost.listen
To retrieve multiple posts, you can use getPostByIds
method provided by PostRepository
. This method accepts a collection of postId
as a parameter and returns a Live Collection ofAmityPost
.