Empty Sentinel Instance

Give a model a canonical empty instance on its companion object so its holders can declare the field non-null, instead of threading a nullable through every layer. Covers when this genuinely removes a whole family of null checks and when it only adds a second check beside the one already there, the emptiness predicate that has to ship with it, keeping the sentinel out of persistence and out of rendered lists, and where a nullable is the honest signal. Use when call sites test both for null and for the sentinel, when an empty-keyed row appears in storage, or when a list renders one blank entry at startup.

maxrave-dev Updated 2.3k repo stars
The SimpMusic repository on GitHub

File contents

maxrave-dev/kotlin-footguns commit 29610470d5

Frequently asked questions

npx get-skill add maxrave-dev/empty-sentinel-instance