GenericFeedBloc<A, Ob, T, Or> class
The generic version of FeedBloc
.
A class dedicated to the state management of an app's Stream feed.
FeedBloc is used to manage a set of operations associated with EnrichedActivitys and Reactions.
FeedBloc can be access at anytime by using the factory of
method
using Flutter's BuildContext.
Usually what you want is the convenient FeedBloc that already has the default parameters defined for you suitable to most use cases. But if you need a more advanced use case use GenericFeedBloc instead
Usage
- {@macro queryEnrichedActivities}
- {@macro queryReactions}
- {@macro onAddActivity}
- {@macro deleteActivity}
- {@macro onAddReaction}
- {@macro onRemoveReaction}
- {@macro onAddChildReaction}
- {@macro onRemoveChildReaction} The generic parameters can be of the following type:
- A :
actor
can be an User, or a String - Ob :
object
can a String, or a CollectionEntry - T :
target
can be a String or an Activity - Or :
origin
can be a String or a Reaction or an User
To avoid potential runtime errors make sure they are the same across the app if you go the route of using Generic* classes
Constructors
-
GenericFeedBloc({required StreamFeedClient client, StreamAnalytics? analyticsClient, UploadController? uploadController, ActivitiesManager<
A, Ob, T, Or> ? activitiesManager, GroupedActivitiesManager<A, Ob, T, Or> ? groupedActivitiesManager, ReactionsManager? reactionsManager}) - A class dedicated to the state management of an app's Stream feed.
Properties
-
activitiesManager
→ ActivitiesManager<
A, Ob, T, Or> -
Manager for activities.
final
- analyticsClient → StreamAnalytics?
-
The underlying analytics client
final
- client → StreamFeedClient
-
The underlying Stream Feed client instance.
final
- currentUser → StreamUser?
-
The current User
no setter
-
groupedActivitiesManager
→ GroupedActivitiesManager<
A, Ob, T, Or> -
Manager for aggregated activities.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
-
props
→ List<
Object?> -
The list of properties that will be used to determine whether
two instances are equal.
no setter
-
queryActivitiesLoading
→ Stream<
bool> -
The stream notifying the state of queryActivities call.
no setter
-
queryGroupedActivitiesLoading
→ Stream<
bool> -
The stream notifying the state of queryActivities call.
no setter
- reactionsManager → ReactionsManager
-
Manager for reactions.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- stringify → bool?
-
If set to
true
, the toString method will be overridden to output this instance's props.no setterinherited - uploadController → UploadController
-
Controller to manage file uploads.
final
Methods
-
clearActivities(
String feedGroup) → void -
Clear activities for a given
feedGroup
. -
clearAllActivities(
List< String> feedGroups) → void -
Clear all activities for the given
feedGroups
. -
clearAllGroupedActivities(
List< String> feedGroups) → void -
Clear all grouped/aggregated activities for the given
feedGroups
. -
clearAllReactions(
List< String> lookupValues) → void - Clear all reactions for the given `lookupValues
-
clearGroupedActivities(
String feedGroup) → void -
Clear grouped/aggregated activities for the given
feedGroup
. -
clearReactions(
String lookupValue) → void -
Clear reactions for a given
lookupValue
. -
dispose(
) → void -
followFeed(
{String followerFeedGroup = 'timeline', String followeeFeedGroup = 'user', required String followeeId}) → Future< void> -
Follows the given
followeeId
id. -
getActivities(
String feedGroup) → List< GenericEnrichedActivity< ?A, Ob, T, Or> > - The current activities list.
-
getActivitiesStream(
String feedGroup) → Stream< List< ?GenericEnrichedActivity< >A, Ob, T, Or> > - The current activities list as a stream.
-
getGroupedActivities(
String feedGroup) → List< Group< ?GenericEnrichedActivity< >A, Ob, T, Or> > - The current grouped (aggregated) activities list
-
getGroupedActivitiesStream(
String feedGroup) → Stream< List< ?Group< >GenericEnrichedActivity< >A, Ob, T, Or> > - The current activities list as a stream.
-
getReactions(
String lookupValue, [Reaction? reaction]) → List< Reaction> - The current reactions list.
-
getReactionsStream(
String lookupValue, [String? kind]) → Stream< List< ?Reaction> > - The current reactions list as a stream.
-
isFollowingFeed(
{String followeeFeedGroup = 'timeline', String followerFeedGroup = 'user', required String followerId}) → Future< bool> -
Checks whether the current user is following a feed with the given
followerId
. -
loadMoreEnrichedActivities(
{required String feedGroup, int? limit, int? offset, String? session, Filter? filter, EnrichmentFlags? flags, String? ranking, String? userId}) → Future< void> - Loads the next paginated enriched activities.
-
loadMoreGroupedActivities(
{required String feedGroup, int? limit, int? offset, String? session, EnrichmentFlags? flags, String? ranking, String? userId}) → Future< void> - Loads the next paginated grouped activities.
-
loadMoreReactions(
String lookupValue, {LookupAttribute lookupAttr = LookupAttribute.activityId, int? limit, String? kind, EnrichmentFlags? flags}) → Future< void> - Loads the next paginated reactions.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onAddActivity(
{required String feedGroup, Map< String, Object> ? data, required String verb, required String object, String? userId, List<FeedId> ? to, DateTime? time}) → Future<Activity> - Add an activity to the feed in a reactive way
-
onAddActivityGroup(
{required String feedGroup, Map< String, Object> ? data, required String verb, required String object, String? userId, List<FeedId> ? to}) → Future<Activity> -
onAddChildReaction(
{required String kind, required Reaction reaction, required String lookupValue, Map< String, Object> ? data, String? userId, List<FeedId> ? targetFeeds}) → Future<Reaction> - Add child reaction to the feed in a reactive way
-
onAddReaction(
{required String kind, required GenericEnrichedActivity< A, Ob, T, Or> activity, required String feedGroup, List<FeedId> ? targetFeeds, Map<String, Object> ? data}) → Future<Reaction> - Add a new reaction to the feed in a reactive way. For example to add a comment under a tweet:
-
onRemoveActivity(
{required String feedGroup, required String activityId}) → Future< void> - Remove an Activity from the feed in a reactive way
-
onRemoveActivityGroup(
{required String feedGroup, required String activityId}) → Future< void> - Remove an Activity from the feed in a reactive way
-
onRemoveChildReaction(
{required String kind, required String lookupValue, required Reaction childReaction, required Reaction parentReaction}) → Future< void> - Remove child reactions from the feed in a reactive way
-
onRemoveReaction(
{required String kind, required GenericEnrichedActivity< A, Ob, T, Or> activity, required Reaction reaction, required String feedGroup}) → Future<void> - Remove reaction from the feed in a reactive way
-
paginatedParamsActivities(
{required String feedGroup}) → NextParams? -
Retrieves the last stored paginated params, NextParams, for the given
feedGroup
. -
paginatedParamsGroupedActivites(
{required String feedGroup}) → NextParams? -
Retrieves the last stored paginated params, NextParams, for the given
feedGroup
. -
paginatedParamsReactions(
{required String lookupValue}) → NextParams? -
Retrieves the last stored paginated params, NextParams, for the given
lookupValue
. -
queryEnrichedActivities(
{required String feedGroup, int? limit, int? offset, String? session, Filter? filter, EnrichmentFlags? flags, String? ranking, String? userId}) → Future< void> -
queryPaginatedEnrichedActivities(
{required String feedGroup, int? limit, int? offset, String? session, Filter? filter, EnrichmentFlags? flags, String? ranking, String? userId, bool refresh = false}) → Future< void> - Queries the activities stream and stores the pagination results.
-
queryPaginatedGroupedActivities(
{required String feedGroup, int? limit, int? offset, String? session, Filter? filter, EnrichmentFlags? flags, String? userId, bool refresh = false}) → Future< void> - Queries the activities stream for aggregated activities and stores the pagination results.
-
queryPaginatedReactions(
LookupAttribute lookupAttr, String lookupValue, {Filter? filter, int? limit, String? kind, EnrichmentFlags? flags, bool refresh = false}) → Future< void> - Queries the reactions stream and stores the pagination results.
-
queryReactions(
LookupAttribute lookupAttr, String lookupValue, {Filter? filter, int? limit, String? kind, EnrichmentFlags? flags}) → Future< void> -
queryReactionsLoadingFor(
String activityId) → Stream< bool> - The stream notifying the state of queryReactions call.
-
refreshPaginatedEnrichedActivities(
{required String feedGroup, int? limit, int? offset, String? session, Filter? filter, EnrichmentFlags? flags, String? ranking, String? userId}) → Future< void> - Refreshes the paginated enriched activities by calling queryPaginatedEnrichedActivities and refreshing the state.
-
refreshPaginatedGroupedActivities(
{required String feedGroup, int? limit, int? offset, String? session, Filter? filter, EnrichmentFlags? flags, String? userId}) → Future< void> - Refreshes the paginated grouped activities by calling queryPaginatedGroupedActivities and refreshing the state.
-
refreshPaginatedReactions(
String lookupValue, {LookupAttribute lookupAttr = LookupAttribute.activityId, Filter? filter, int? limit, String? kind, EnrichmentFlags? flags}) → Future< void> - Refreshes the paginated reactions by calling queryPaginatedReactions and refreshing the state.
-
toString(
) → String -
A string representation of this object.
inherited
-
trackAnalytics(
{required String label, String? foreignId, required String feedGroup}) → Future< void> - Track analytics.
-
unfollowFeed(
{String unfollowerFeedGroup = 'timeline', String unfolloweeFeedGroup = 'user', required String unfolloweeId}) → Future< void> -
Unfollows the given
unfolloweeId
id.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited