GenericEnrichedActivity<A, Ob, T, Or> class

Enrichment is a concept in Stream that enables our API to work quickly and efficiently.

It is the concept that most data is stored as references to an original data. For example, if I add an activity to my feed and it fans out to 50 followers, the activity is not copied 50 times, but the activity is stored in a single table only once, and references are stored in 51 feeds.

The same rule applies to users and reactions. They are stored only once, but references are used elsewhere.

An Enriched Activity is an Activity with additional fields that are derived from the Activity's

This class makes use of generics in order to have a more flexible API surface. Here is a legend of what each generic is for:

Annotations
  • @JsonSerializable(genericArgumentFactories: true)
  • @DateTimeUTCConverter()

Constructors

GenericEnrichedActivity({String? id, A? actor, String? verb, Ob? object, String? foreignId, T? target, DateTime? time, Or? origin, List<String>? to, double? score, Map<String, Object>? analytics, Map<String, Object>? extraContext, Map<String, Object?>? extraData, Map<String, int>? reactionCounts, Map<String, List<Reaction>>? ownReactions, Map<String, List<Reaction>>? latestReactions})
Builds an GenericEnrichedActivity.
const
GenericEnrichedActivity.fromJson(Map<String, dynamic>? json, [A fromJsonA(Object? json)?, Ob fromJsonOb(Object? json)?, T fromJsonT(Object? json)?, Or fromJsonOr(Object? json)?])
Create a new instance from a JSON object
factory

Properties

actor → A?
The actor performing the activity.
final
analytics Map<String, Object>?
final
extraContext Map<String, Object>?
final
extraData Map<String, Object?>?
Map of custom user extraData
final
foreignId String?
A unique ID from your application for this activity.
final
hashCode int
The hash code for this object.
no setterinherited
id String?
The Stream id of the activity.
final
latestReactions Map<String, List<Reaction>>?
Include recent reactions to activities.
final
object → Ob?
The object of the activity.
final
origin → Or?
The feed id where the activity was posted.
final
ownReactions Map<String, List<Reaction>>?
Include reactions added by current user to all activities.
final
props List<Object?>
The list of properties that will be used to determine whether two instances are equal.
no setter
reactionCounts Map<String, int>?
Include reaction counts to activities.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
score double?
final
stringify bool?
If set to true, the toString method will be overridden to output this instance's props.
no setterinherited
target → T?
Describes the target of the activity.
final
time DateTime?
The optional time of the activity in iso format.
final
to List<String>?
An array allows you to specify a list of feeds to which the activity should be copied.
final
verb String?
The verb of the activity.
final

Methods

copyWith({A? actor, Ob? object, String? verb, T? target, List<String>? to, String? foreignId, String? id, DateTime? time, Map<String, Object>? analytics, Map<String, Object>? extraContext, Or? origin, double? score, Map<String, Object>? extraData, Map<String, int>? reactionCounts, Map<String, List<Reaction>>? ownReactions, Map<String, List<Reaction>>? latestReactions}) GenericEnrichedActivity<A, Ob, T, Or>
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toJson(Object? toJsonA(A value), Object? toJsonOb(Ob value), Object? toJsonT(T value), Object? toJsonOr(Or value)) Map<String, dynamic>
Serialize to JSON
toString() String
A string representation of this object.
inherited

Operators

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

Constants

topLevelFields → const List<String>
Known top level fields. Useful for Serializer methods.