Skip to main content

PostService class

PostService class provides functions in the context of a Post.

Services include:

  • getPosts : to get all posts of the organization.
  • addLike : to add like to the post.
  • removeLike : to remove the like from the post.

Inheritance

: - Object

Constructors

PostService

:

Properties

[after] [↔ String?]

: ::: features getter/setter pair :::

[before] [↔ String?]

: ::: features getter/setter pair :::

[cacheKey] [→ String] : feed cacheBox key. ::: features finalinherited :::

[first] [↔ int?]

: ::: features getter/setter pair :::

[hashCode] [→ int] : The hash code for this object. ::: features no setterinherited :::

[last] [↔ int?]

: ::: features getter/setter pair :::

[postInfo] [↔ Map[<[String], dynamic>]?]

: ::: features getter/setter pair :::

[postStream] [→ Stream[<[List[<[Post]>]]>]] : Getter for Stream of posts. ::: features no setter :::

[runtimeType] [→ Type] : A representation of the runtime type of the object. ::: features no setterinherited :::

[updatedPostStream] [→ Stream[<[Post]>]] : Getter for Stream of update in any post. ::: features no setter :::

Methods

[addCommentLocally][([[String] postID]) → void ] : Method to add comment of a user and update comments using updated Post Stream.

[addLike][([[String] postID]) [→ Future[<[bool]>]] ] : Method to add like on a Post.

[addNewpost][([[Post] newPost]) → void ] : Method to add newly created post at the very top of the feed.

[deletePost][([[Post] post]) [→ Future[<[QueryResult[<[Object?]>]]>]] ]

:

[fetchDataFromApi][ [→ Future[<[List[<[Post]>]]>]] ] : Abstract method to be implemented by subclasses to fetch data from an API. ::: features override :::

[fetchPostsInitial][ [→ Future<[void>]] ]

:

[getNewFeedAndRefreshCache][ [→ Future[<[List[<[Post]>]]>]] ] : Fetches new data from the API if online, updates the cache, and returns the data. ::: features inherited :::

[getPosts][ [→ Future<[void>]] ] : Method used to fetch all posts of the current organisation.

[loadCachedData][ [→ Future[<[List[<[Post]>]]>]] ] : Loads the data cached in Hive. ::: features inherited :::

[nextPage][ [→ Future<[void>]] ] : Method to handle pagination by fetching next page of posts.

[noSuchMethod][([[Invocation] invocation]) → dynamic ] : Invoked when a nonexistent method or property is accessed. ::: features inherited :::

[previousPage][ [→ Future<[void>]] ] : Method to handle pagination by fetching previous page of posts.

[refreshFeed][ [→ Future<[void>]] ] : Method to refresh feed of current selected organisation.

[removeLike][([[String] postID]) [→ Future[<[bool]>]] ] : Method to remove like in a Post.

[saveDataToCache][([[List[<[Post]>]] data]) [→ Future<[void>]] ] : Saves a list of data to the cache, replacing any existing data. ::: features inherited :::

setOrgStreamSubscription [→ void ] : This method sets up a stream that constantly listens to change in current org.

[toString][ [→ String] ] : A string representation of this object. ::: features inherited :::

Operators

[operator ==][([[Object] other]) [→ bool] ] : The equality operator. ::: features inherited :::

  1. talawa
  2. post_service
  3. PostService class
post_service library