ViewModelListProperty

class ViewModelListProperty(unsafeCppPointer: Long, fileLock: ReentrantLock) : ViewModelProperty<Unit>

A list property of ViewModelInstances.

The list is mutable, and can be modified at runtime using add, remove, removeAt, and swap.

The list does not have one particular value to get or set, so value and valueFlow are not applicable and will always return Unit.

See also

Constructors

Link copied to clipboard
constructor(unsafeCppPointer: Long, fileLock: ReentrantLock)

Properties

Link copied to clipboard

Getter/Setter for the underlying C++ pointer value.

Link copied to clipboard
Link copied to clipboard

Whether this objects underlying pointer is still valid.

Link copied to clipboard

The name of the property.

Link copied to clipboard
open val refCount: Int
Link copied to clipboard
override var refs: AtomicInteger
Link copied to clipboard
val size: Int

The number of items in the list.

Link copied to clipboard
var value: Unit

The current value of the property, whether set by this property or by a data binding update.

Link copied to clipboard
val valueFlow: StateFlow<Unit>

A flow of the property's value. Use for observing changes.

Functions

Link copied to clipboard
open override fun acquire(): Int

Increments the references for this counter. Cannot be used for initialization - use refs.incrementAndGet instead.

Link copied to clipboard

Append the ViewModelInstance to the end of the list.

fun add(index: Int, item: ViewModelInstance)

Insert the ViewModelInstance at the specified index. The item currently at that index and all subsequent items will be shifted one position to the right.

Link copied to clipboard
open override fun cppDelete(pointer: Long)
Link copied to clipboard
@VisibleForTesting(otherwise = 2)
external fun cppHasChanged(cppPointer: Long): Boolean
Link copied to clipboard
external fun cppName(cppPointer: Long): String
Link copied to clipboard

Get the ViewModelInstance at the specified index.

Link copied to clipboard
operator fun get(index: Int): ViewModelInstance
Link copied to clipboard
open override fun release(): Int

Release this property while holding the current file lock.

Link copied to clipboard

Remove all instances of ViewModelInstance from the list.

Link copied to clipboard
fun removeAt(index: Int)

Remove the item at the specified index from the list. The items after the removed item will be shifted one position to the left.

Link copied to clipboard
fun swap(index1: Int, index2: Int)

Swap the items at indices index1 and index2.