surrealdb_wasm 0.7.0+3 copy "surrealdb_wasm: ^0.7.0+3" to clipboard
surrealdb_wasm: ^0.7.0+3 copied to clipboard

Flutter SurrealDB WebAssembly(WASM) package

surrealdb_wasm #

pub package browser tests style: very good analysis License: MIT

The Flutter SurrealDB WebAssembly (WASM) package is a powerful integration for Flutter, built upon the foundation of surrealdb.wasm, the official SurrealDB library for WebAssembly.

🔍 Demo #

Try out surreal_wasm applications in your browser:

💻 Installation #

❗ In order to start using surrealdb_wasm you must have the Flutter SDK installed on your machine.

Install via flutter pub add:

flutter pub add surrealdb_wasm

Alternatively, add surrealdb_wasm to your pubspec.yaml:

dependencies:
  surrealdb_wasm:

Install it:

flutter pub get

✨ Features #

  • [x] connect()
  • [x] use()
  • [x] create()
  • [x] update()
  • [x] merge()
  • [x] delete()
  • [x] select()
  • [x] query()
  • [x] transaction()
  • [x] set()
  • [x] unset()
  • [x] signup()
  • [x] signin()
  • [ ] invalidate()
  • [ ] authenticate()
  • [x] patch()
  • [x] version()
  • [x] health()

🏃 Examples #

Basic #

final db = Surreal();

await db.connect('indxdb://surreal');
await db.use(ns: 'test', db: 'test');

final created = db.create('person',
          {
            'title': 'CTO',
            'name': {
              'first': 'Tom',
              'last': 'Jerry',
            },
            'marketing': true,
          },
        );

// created['id']: person:b9eht8bie8abf0vbcfxh
final merged = await db.merge(
        created['id'],
        {
          'marketing': false,
        },
      );

final tom = await db.select(created['id']);

final deleted = await db.delete(created['id']);

For more code examples, kindly refer to the integration test and the example project.

Transaction Support #

final result = await db.transaction((txn) async {
    txn.query('DEFINE TABLE test SCHEMAFULL;');
    txn.query('DEFINE FIELD id ON test TYPE record;');
    txn.query('DEFINE FIELD name ON test TYPE string;');
    txn.query(
      r'CREATE test SET name = $name;',
      bindings: {'name': 'John'},
    );
    if (somethingWrong) {
      txn.cancel();
    }
});

For more code examples, kindly refer to the integration test of transaction.

🧑‍💼 Contributing #

Contributions are welcome! Please check out the unimplemented features above, issues on the repository, and feel free to open a pull request. For more information, please see the contribution guide.

📔 License #

This project is licensed under the terms of the MIT license.

🗒️ Citation #

If you utilize this package, please consider citing it with:

@misc{surrealdb_wasm,
  author = {Lim Chee Kin},
  title = {surrealdb_wasm: Flutter SurrealDB WebAssembly(WASM) package},
  year = {2023},
  publisher = {GitHub},
  journal = {GitHub repository},
  howpublished = {\url{https://github.com/limcheekin/surrealdb_wasm}},
}
3
likes
0
pub points
42%
popularity

Publisher

unverified uploader

Flutter SurrealDB WebAssembly(WASM) package

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, js

More

Packages that depend on surrealdb_wasm