idb_sqflite 1.3.3+6 copy "idb_sqflite: ^1.3.3+6" to clipboard
idb_sqflite: ^1.3.3+6 copied to clipboard

IndexedDB API on top of sqflite for Flutter (Desktop and Mobile) and DartVM io applications

idb_sqflite #

Indexed DB for flutter on top of sqflite.

  • Supports both iOS and Android
  • Supports Flutter Web through idb_shim.
  • Supports Dart VM (Desktop) through idb_shim

Example #

Simple notepad available here running on Flutter (iOS/Android/Web).

Getting Started #

import 'package:idb_sqflite/idb_sqflite.dart';
import 'package:sqflite/sqflite.dart';

Future main() async {
  // The sqflite flutter factory
  var factory = getIdbFactorySqflite(databaseFactory);
  // define the store name
  const String storeName = "records";

  // open the database
  Database db = await factory.open("my_records.db", version: 1,
      onUpgradeNeeded: (VersionChangeEvent event) {
    Database db = event.database;
    // create the store
    db.createObjectStore(storeName, autoIncrement: true);
  });

  // put some data
  var txn = db.transaction(storeName, idbModeReadWrite);
  var store = txn.objectStore(storeName);
  var key = await store.put({"some": "data"});
  await txn.completed;

  // read some data
  txn = db.transaction(storeName, idbModeReadOnly);
  store = txn.objectStore(storeName);
  var value = await store.getObject(key);

  print(value);
  await txn.completed;
}

See idb_shim for API usage or more generally the W3C reference

44
likes
160
points
243
downloads

Publisher

verified publishertekartik.com

Weekly Downloads

IndexedDB API on top of sqflite for Flutter (Desktop and Mobile) and DartVM io applications

Repository (GitHub)
View/report issues

Topics

#database

Documentation

API reference

License

BSD-2-Clause (license)

Dependencies

idb_shim, meta, sqflite_common, synchronized

More

Packages that depend on idb_sqflite