decodeFromString

Decodes a layout written by encodeToString, or null when text is not one.

Returning null rather than throwing is what makes this safe to point at a stored value of unknown provenance — an empty preference, something another version of the app wrote, or a value that was never a layout at all. Within a layout it recognises, entries it cannot parse are skipped rather than failing the whole restore: one unreadable width is not a reason to lose the other twenty.