Skip to content

Async Storage SQLite

Multiplatform key-value storage backed by SQLite for React Native Async Storage

version badge

Installation

Android

implementation("io.github.react-native-async-storage:async-storage-sqlite:VERSION")
implementation "io.github.react-native-async-storage:async-storage-sqlite:VERSION"

iOS

pod 'AsyncStorageSQLiteKMP', 'VERSION'

Quick start

Android

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)
}

iOS

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)
}

Visit Usage page to learn more