Native Datastore
The Native Datastore feature in Twinr allows you to store and retrieve data locally on a user’s device.
This can be useful for saving preferences, user settings, or small amounts of data that should persist across app sessions without requiring network requests. With Twinr’s Native Datastore, you can store integers, booleans, and strings, as well as retrieve them when needed.
Store Int Data
Stores an integer value locally on the device under a specified key.
In this example, the integer 100 is saved under the key "userScore".
Store String Data
Stores a string value locally on the device under a specified key.
In this case, the string "JohnDoe" is saved under the key "userName".
Store Bool Data
Stores a boolean value (true/false) locally on the device under a specified key.
Here, the boolean value true is stored under the key "isLoggedIn".
Get Local Data
Retrieves a value stored locally on the device using the specified key.
In this example, the value stored under "userScore" is retrieved. The function returns a promise that resolves to the stored value.
Last updated