How to use it
Android library to simplify reading and writing to SharedPreferences, never write code like this anymore prefs.edit().putString("someKey","someString").apply()
Just create a model with wanted properties and default values like the this:
@Bulldog(name = "UserSettings")
object UserModel {
const val id: Int = 20 // Default value
const val email: String = "johndoe@gmail.com"
const val likes: Long = 20L
const val isPremium: Boolean = false
const val minutesLeft: Float = 24.5F
}Bulldog will generate a class from this specification with the name UserSettings. Use it like a normal object to access values, under the hood it uses Kotlin delegated properties to read and writes values to SharedPreferences.
UserSettings().apply {
id = 2
email = "abc@gmail.com"
}
Log.d("PREFS", UserSettings().id)
Log.d("PREFS", UserSettings().toString())Read values
Just access object property like a normal object
Write values
Clear values
Bulldog generates a clear method for each entry
Print information
Bulldog also generates a toString() human readable implementation
Last updated