SagaInfiniteMapController class
Stateful controller that manages lazy loading map chunks.
Set maxRetainedChunks to bound memory on a genuinely endless map: chunks far from the ones being read are dropped, and reloaded on demand if the user scrolls back. Loaders are expected to be deterministic, so a reloaded chunk is identical to the one that was dropped.
- Inheritance
-
- Object
- ChangeNotifier
- SagaInfiniteMapController
Constructors
- SagaInfiniteMapController({required SagaChunkLevelLoader chunkLoader, int sectionsPerChunk = kSagaMapChunkSize, int initialChunkCount = 3, int loadBatchSize = 2, int? maxChunkCount, int? maxRetainedChunks})
Properties
- chunkLoader → SagaChunkLevelLoader
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
- hasReachedEnd → bool
-
Whether configured maxChunkCount has been reached.
no setter
- initialChunkCount → int
-
final
- isLoading → bool
-
True while a chunk batch is being loaded.
no setter
- lastError → Object?
-
Last loader error, if any.
no setter
- loadBatchSize → int
-
final
- loadedChunkCount → int
-
Highest chunk index reached, whether or not it is still in memory.
no setter
- maxChunkCount → int?
-
final
- maxRetainedChunks → int?
-
Target number of chunks kept in memory, or
nullto keep every chunk ever loaded.final -
reloadingChunkIndices
→ Set<
int> -
Indices whose levels were evicted and are being loaded again.
no setter
- retainedChunkCount → int
-
Chunks currently held in memory. Equal to loadedChunkCount unless
maxRetainedChunks has forced evictions.
no setter
-
retainedChunkIndices
→ Set<
int> -
Indices of the chunks currently held in memory.
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- sectionsPerChunk → int
-
final
Methods
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
chunkLevels(
int chunkIndex) → List< LevelData> - Returns levels loaded for the requested chunk.
-
dispose(
) → void -
Discards any resources used by the object.
override
-
initialize(
) → Future< void> - Loads initial chunk set once.
-
loadMore(
{int? count}) → Future< void> - Loads more chunks according to controller strategy.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
reset(
) → void - Clears loaded chunks and returns to initial state.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited