Multiplatform key-value storage backed by SQLite for React Native Async Storage
implementation("io.github.react-native-async-storage:async-storage-sqlite:VERSION")pod'AsyncStorageSQLiteKMP','VERSION'Visit Usage page to learn more
importorg.asyncstorage.sqlitestorage.SQLiteStorageFactoryval storage =SQLiteStorageFactory(this).create("my_database_name")
suspendfunsingle(): Entry {
val entry = storage.read("my_key")
return entry
}
suspendfunsingleWrite() {
val entry =Entry("my_key", "my_value")
storage.write(entry)
}import AsyncStorageSQLite
letstorage=AsyncStorageSQLite("my_database_name")func single()asyncthrows->Entry{letentry=tryawait storage.read(key:"my_key")return entry
}func singleWrite()asyncthrows{letentry=Entry(key:"my_key", value:"my_value")tryawait storage.write(entry: entry)}Gradle tasks to run tests:
storageTests - run unit tests for all platforms
storageTestsAndroid - run unit tests for Android platform
storageTestsIos - run unit tests for iOS platform
Re-running tests when tasks are up-to-date:
./gradlew :sqlite-storage:storageTests --rerun-tasks
- Make sure Python 3 (v3.11.7+) and pip (v24.0+) is installed
- Follow installation steps from MkDocs Material
- Run development docs:
mkdocs serve