FetchUserFeedAction class

A ReduxAction used to fetch user's feed. Retrieves the current feed from state and passes the data to feedStreamController

  1. => Incase the retrieved userFeed is UNKNOWN or the feed is to be refreshed;
    • A query is made to get new feed
    • Happy Case: Feed data is encoded into a string and SaveUserFeedAction is triggered to store feedState
    • Pass the feed to the stream controller directly
  2. => Incase the retrieved userFeed is not UNKNOWN or doesn't require refresh;
    • Retrieved userFeed is decoded
    • Feed is then passed directly to feed stream controller

Constructors

FetchUserFeedAction({required StreamController feedStreamController, required IGraphQlClient client, bool refreshFeed = false})

Properties

client → IGraphQlClient
final
dispatch → Dispatch<CoreState>
no setterinherited
dispatchAsync → DispatchAsync<CoreState>
no setterinherited
dispatchSync → DispatchSync<CoreState>
no setterinherited
env Object?
no setterinherited
feedStreamController StreamController
final
hasFinished bool
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
isFinished bool
Returns true only if the action finished with no errors. In other words, if the methods before, reduce and after all finished executing without throwing any errors.
no setterinherited
microtask Future
To wait for the next microtask: await microtask;
no setterinherited
refreshFeed bool
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
state CoreState
no setterinherited
stateTimestamp DateTime
no setterinherited
status → ActionStatus
no setterinherited
store → Store<CoreState>
no setterinherited

Methods

abortDispatch() bool
If this returns true, the action will not be dispatched: before, reduce and after will not be called, and the action will not be visible to the StoreTester. This is only useful under rare circumstances, and you should only use it if you know what you are doing.
inherited
after() → void
This is an optional method that may be overridden to run during action dispatching, after reduce. If this method throws an error, the error will be swallowed (will not throw). So you should only run code that can't throw errors. It may be synchronous only. Note this method will always be called, even if errors were thrown by before or reduce.
inherited
assertUncompletedFuture() → void
An async reducer (one that returns Future<AppState?>) must never complete without at least one await, because this may result in state changes being lost. It's up to you to make sure all code paths in the reducer pass through at least one await.
inherited
before() FutureOr<void>
This is an optional method that may be overridden to run during action dispatching, before reduce. If this method throws an error, the reduce method will NOT run, but the method after will. It may be synchronous (returning void) ou async (returning Future<void>). You should NOT return FutureOr.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
reduce() Future<CoreState?>
The reduce method is the action reducer. It may read the action state, the store state, and then return a new state (or null if no state change is necessary).
reduceWithState(Store<CoreState> store, CoreState state) FutureOr<CoreState?>
Nest state reducers without dispatching another action. Example: return AddTaskAction(demoTask).reduceWithState(state);
inherited
runtimeTypeString() String
Returns the runtimeType, without the generic part.
inherited
setStore(Store<CoreState> store) → void
inherited
toString() String
A string representation of this object.
inherited
wrapError(Object error) Object?
If any error is thrown by reduce or before, you have the chance to further process it by using wrapError. Usually this is used to wrap the error inside of another that better describes the failed action. For example, if some action converts a String into a number, then instead of throwing a FormatException you could do:
inherited
wrapReduce(Reducer<CoreState> reduce) → Reducer<CoreState>
You may wrap the reducer to allow for some pre or post-processing. For example, if you want to abort an async reducer if the state changed since when the reducer started:
inherited

Operators

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