Ir al contenido

Public Mutable Property (ARCH8186)

Esta página aún no está disponible en tu idioma.

Key kotlin.quality.public-mutable-field · Severity warning · Category quality

Flags public var properties on classes - state anyone can change from anywhere.

class Cart { var items = mutableListOf<Item>() }
class Cart {
private val _items = mutableListOf<Item>()
val items: List<Item> get() = _items
}

Use private set or expose a read-only view.