rocket / com.stavro_xhardha.rocket / Rocket

Rocket

class Rocket

This is the main and only true class of this small project

Functions

crash

fun crash(): Unit

Clears all values saved to Shared Preferences

drop

fun drop(vararg key: String): Unit

Removes a number of saved values found by a key

readBoolean

fun readBoolean(key: String, defaultBooleanValue: Boolean = false): Boolean

Reads an Boolean from SharedPreferences. If no value is found the method returns false by default

readBooleanAsFlow

fun readBooleanAsFlow(key: String, defaultBooleanValue: Boolean = false): Flow<Boolean>

Flow support for getting a Boolean from SharedPreferences

readFloat

fun readFloat(key: String, defaultFloatValue: Float = 0f): Float

Reads an Float from SharedPreferences. If no value is found the method returns 0f by default

readFloatAsFLow

fun readFloatAsFLow(key: String, defaultFloatValue: Float = 0f): Flow<Float>

Flow support for getting a Float from SharedPreferences

readInt

fun readInt(key: String, defaultIntValue: Int = 0): Int

Reads an Int from SharedPreferences. If no value is found the method returns 0 by default

readIntAsFlow

fun readIntAsFlow(key: String, defaultIntValue: Int = 0): Flow<Int>

Flow support for getting and Int from SharedPreferences. If no value is found the method emits 0 by default

readLong

fun readLong(key: String, defaultLongValue: Long = 0L): Long

Reads an Long from SharedPreferences. If no value is found the method returns 0L by default

readLongAsFlow

fun readLongAsFlow(key: String, defaultLongValue: Long = 0L): Flow<Long>

Flow support for getting a Log value from SharedPreferences

readSet

fun readSet(key: String, defaultSetValue: MutableSet<String> = mutableSetOf()): MutableSet<String>

Reads an Long from SharedPreferences. If no value is found the method returns 0L by default

readSetAsFlow

fun readSetAsFlow(key: String): Flow<String>

Flow support for getting a stream Flow

readString

fun readString(key: String, defaultStringValue: String = ""): String

Reads a String from SharedPreferences

readStringAsFlow

fun readStringAsFlow(key: String, defaultStringValue: String = ""): Flow<String>

Flow support for getting a String value from SharedPreferences

writeBoolean

fun writeBoolean(key: String, value: Boolean): Unit

Writes a Boolean to SharedPreferences

writeFloat

fun writeFloat(key: String, value: Float): Unit

Writes a Float to SharedPreferences

writeInt

fun writeInt(key: String, value: Int): Unit

Writes a Int to SharedPreferences

writeLong

fun writeLong(key: String, value: Long): Unit

Writes a Long value to SharedPreferences

writeSet

fun writeSet(key: String, value: MutableSet<String>): Unit

Writes a MutableSet to SharedPreferences

writeString

fun writeString(key: String, value: String): Unit

Writes a String to SharedPreferences

Companion Object Functions

launch

fun launch(context: Context, fileName: String, mode: Int = Context.MODE_PRIVATE): Rocket

Method for starting the Rocket's instance.