ResidentRebuilder class
Owns the resident backend's lifecycle for one DraftCanvas attachment:
when to rebuild, and what the frame paints through meanwhile.
The frame never waits (Ruling F3). noteFrame is O(1) and never walks; markDirty records a reason and schedules ONE post-frame callback; the callback walks and classifies (on the UI thread, after the frame's paint has finished), awaits the upload, swaps backend in and notifies. A trigger during the await queues exactly one more rebuild. The frame that fires a trigger is drawn with the collection it has -- criterion 9's stale interval, counted in bandStaleFrames for the band case.
Once an upload returns null the rebuilder stops (uploadFailed):
no backend, no retry, every later markDirty ignored. The widget paints
through VerticesDrawSink from then on and says so once (Ruling F5).
- Inheritance
-
- Object
- ChangeNotifier
- ResidentRebuilder
Constructors
- ResidentRebuilder({required DraftDocument document, required DraftPainter painter, required ResidentUploader uploader, required double pixelsPerPaperMm, required double lineweightScale, required TextMeasurer? measurer, required TextStyleRecord textStyleOf(Handle)?, double bandLowerScale = kBandLowerScale, double bandUpperScale = kBandUpperScale})
Properties
- backend → ResidentFramePainter?
-
no setter
- bandLowerScale → double
-
final
- bandStaleFrames ↔ int
-
Frames noteFrame saw with the camera outside the band -- drawn from
a collection the band has already condemned. Criterion 9's number.
getter/setter pair
- bandUpperScale → double
-
final
- collection → ResidentCollection?
-
no setter
- disposed → bool
-
no setter
- document → DraftDocument
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- inFlight → bool
-
no setter
- landed ↔ int
-
getter/setter pair
- lastClassifyMicros ↔ int
-
getter/setter pair
- lastTotalMicros ↔ int
-
getter/setter pair
- lastTrigger ↔ RebuildTrigger?
-
getter/setter pair
- lastUploadMicros ↔ int
-
getter/setter pair
- lastWalkMicros ↔ int
-
getter/setter pair
- lineweightScale → double
-
final
- measurer → TextMeasurer?
-
final
- painter → DraftPainter
-
The widget's own painter: its
drawTextandminTextCapPixelsare the walk's. Reused across rebuilds, never rebuilt here.final - pending → RebuildTrigger?
-
no setter
- pixelsPerPaperMm → double
-
final
- rebuilds ↔ int
-
Walks started. Every walk lands (landed) unless dispose ran first.
getter/setter pair
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- schedules ↔ int
-
Post-frame callbacks registered. One per coalesced rebuild; a value
above landed means marks were not coalesced.
getter/setter pair
- textStyleOf → TextStyleRecord Function(Handle)?
-
final
- uploader → ResidentUploader
-
final
- uploadFailed → bool
-
no setter
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
dispose(
) → void -
Discards any resources used by the object.
override
-
inBand(
ViewportTransform camera) → bool -
Whether
camera's scale, over the collection's, is inside[bandLowerScale, bandUpperScale]. Live over collection, read every frame -- the spec's mutation is reading it against the reference scale, which makes every ratio 1. A geometric decision made with plain comparisons on a ratio; conservative by construction. False with no collection. -
markDirty(
RebuildTrigger trigger) → void -
Records
triggerand schedules a rebuild after the current frame, if one is not already scheduled or in flight. The first reason wins the name. Ignored after dispose and after a failed upload. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
noteFrame(
ViewportTransform camera, Size viewport, double dpr, int tablesRevision) → void -
Every frame, before the draw. Stores the frame's camera, viewport and
dpr for the next rebuild, then fires the three frame-read triggers in
this order: no collection -> RebuildTrigger.initial; a table revision
other than the collection's -> RebuildTrigger.tables; a dpr other
than the collection's (exact
==, a stored value) -> RebuildTrigger.devicePixelRatio; a camera outside the band -> RebuildTrigger.band. One reason per frame; they coalesce anyway. -
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
rebuildNow(
ViewportTransform camera, Size viewport, double dpr, RebuildTrigger trigger) → Future< void> - The walk, the classification, the upload, the swap. Public for the harness's trigger phases and the tests; the schedule calls it too.
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited