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
import org.asyncstorage.sqlitestorage.SQLiteStorageFactory
val storage = SQLiteStorageFactory(this).create("my_database_name")
suspend fun single(): Entry {
val entry = storage.read("my_key")
return entry
}
suspend fun singleWrite() {
val entry = Entry("my_key", "my_value")
storage.write(entry)
}
import AsyncStorageSQLite
let storage = AsyncStorageSQLite("my_database_name")
func single() async throws -> Entry {
let entry = try await storage.read(key: "my_key")
return entry
}
func singleWrite() async throws {
let entry = Entry(key: "my_key", value: "my_value")
try await 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