ValueEntry

CollectionEntryceramic.ValueEntry (Class)

A collection entry that can hold any value.

This class extends CollectionEntry to provide a generic container that can be stored in a Collection. It combines the ID/name functionality of CollectionEntry with the ability to store any typed value.

ValueEntry is useful when you need to store heterogeneous data in collections while maintaining type safety for individual entries.

Example usage:

// Create a collection of settings
var settings = new Collection<ValueEntry<Dynamic>>();

// Add different types of values
settings.add(new ValueEntry<Bool>(true, "enableSound", "Enable Sound"));
settings.add(new ValueEntry<Float>(0.8, "volume", "Volume Level"));
settings.add(new ValueEntry<String>("high", "quality", "Graphics Quality"));

// Retrieve values by ID
var soundEnabled = settings.get("enableSound").value; // true
var volume = settings.get("volume").value; // 0.8

Instance Members

value: ceramic.ValueEntry.T

The stored value of type T. Can be read and written directly.


new(value: ceramic.ValueEntry.T, ?id: String, ?name: String): Void

Create a new ValueEntry.

Name Type Default Description
value ceramic.ValueEntry.T The value to store in this entry
id String (optional) Optional unique identifier for this entry in a collection
name String (optional) Optional human-readable name for this entry