ThemeFeed class final
The swipe feed. Mutable; one per app (the theme controller owns it).
Constructors
- ThemeFeed({required int feedSeed, FeedFilter filter = const FeedFilter.surpriseMe(), FeedEntry? initial, ThemeIntent? intent, int maxHistory = defaultMaxHistory, int prefetchCount = 3, PrefetchHook? onPrefetch})
-
A new feed for
feedSeed(use randomFeedSeed on first launch and persist it). The first theme isinitial, or step 0 of the feed. - ThemeFeed.fromJson(Object? json, {int maxHistory = defaultMaxHistory, int prefetchCount = 3, PrefetchHook? onPrefetch})
-
Restores toJson output. Entries this build cannot reproduce are
dropped; an unusable state starts a fresh feed (same seed if known).
factory
Properties
- canGoBack → bool
-
no setter
- canGoForward → bool
-
no setter
- current → FeedEntry
-
The current theme.
no setter
- cursor → int
-
Index of current in history.
no setter
- feedSeed → int
-
final
- filter ↔ FeedFilter
-
Changes the family filter. Themes already in the history stay; new
themes come from
value.getter/setter pair - hashCode → int
-
The hash code for this object.
no setterinherited
-
history
→ List<
FeedEntry> -
History, oldest first (unmodifiable view).
no setter
- intent → ThemeIntent?
-
The steering intent new themes follow; null when unsteered.
no setter
- locked ↔ bool
-
While locked, next and previous do nothing and return null (the
UI rubber-bands). jumpTo (an explicit apply) still works.
getter/setter pair
- maxHistory → int
-
History cap (oldest entries are dropped).
final
- onPrefetch ↔ PrefetchHook?
-
Called after every move or filter change with upcoming.
getter/setter pair
- prefetchCount → int
-
How many entries onPrefetch receives.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
steeredFamilies
→ List<
ThemeFamily> -
The families steered steps draw from: the intent's families allowed
by the filter (the intent's own when none is); with no intent
families, the filter's steerableFamilies (the whole filter when
none is steerable).
no setter
- steps → int
-
New themes drawn so far (the next new theme is step steps).
no setter
Methods
-
entryAt(
int step) → FeedEntry -
The entry for new-theme step
stepunder the current filter: a hero on hero steps (every 8–12 steps, seeded), otherwise a generated theme whose seed and family come fromRng.stream(feedSeed, 'feed/step/k'). -
isHeroStep(
int step) → bool -
Whether step
stepis a hero slot. -
jumpTo(
FeedEntry entry) → FeedEntry -
Applies
entry(favourite, share code, theme of the day): drops any forward history and pushes it, so back returns to where the user was. -
next(
) → FeedEntry? - Moves to the next theme: replays the history forward after previous, otherwise draws a new one. Null while locked.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
previous(
) → FeedEntry? - Moves back to the exact previous theme. Null while locked or at the start of the history.
-
steer(
ThemeIntent? intent) → FeedEntry -
Steers new themes by
intent(engine v4) and moves to the first of them, centred on the intent (forward history is dropped, as with jumpTo; back returns to where the user was). Steered steps have no heroes and draw from steeredFamilies. A null or empty intent stops steering without moving. Works while locked (an explicit apply). -
toJson(
) → Map< String, Object?> -
toString(
) → String -
A string representation of this object.
inherited
-
upcoming(
[int count = 3]) → List< FeedEntry> -
The next
countentries next would return, in order (pure; does not move the feed). The prefetch hook.
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
randomFeedSeed(
) → int -
A fresh random feed seed (
Random.secure; never used for generation itself, only to pick where this install's feed starts).
Constants
- defaultMaxHistory → const int
- heroGapMax → const int
- heroGapMin → const int
- Smallest and largest number of new themes between heroes.
- jsonFormat → const int
-
JSON layout version. Steering added optional keys (
intent,intentStep) without a bump: older builds ignore them.