PreferencesSerializer


object PreferencesSerializer : OkioSerializer


Proto based serializer for Preferences. Can be used to manually create DataStore using the DataStoreFactory#create function.

Summary

Public functions

open suspend Preferences

Unmarshal object from source.

open suspend Unit

Marshal object to a Sink.

Public properties

open Preferences

Value to return if there is no data on disk.

Public functions

readFrom

open suspend fun readFrom(source: BufferedSource): Preferences

Unmarshal object from source.

Parameters
source: BufferedSource

the BufferedSource with the data to deserialize

writeTo

Added in 1.1.0
open suspend fun writeTo(t: Preferences, sink: BufferedSink): Unit

Marshal object to a Sink.

Parameters
t: Preferences

the data to write to output

sink: BufferedSink

the BufferedSink to serialize data to

Public properties

defaultValue

Added in 1.1.0
open val defaultValuePreferences

Value to return if there is no data on disk.