cindel 0.6.5 copy "cindel: ^0.6.5" to clipboard
cindel: ^0.6.5 copied to clipboard

Generated typed local database for Flutter and Dart apps with MDBX, SQLite, and SQLite Web/OPFS backends.

example/README.md

Cindel example #

Add Cindel, the Flutter native libraries package, and the generator to your app:

dependencies:
  cindel: ^0.6.4
  cindel_flutter_libs: ^0.6.4

dev_dependencies:
  build_runner: ^2.15.0
  cindel_generator: ^0.6.4

Define a model and generate its schema:

import 'package:cindel/cindel.dart';

part 'user.g.dart';

@Collection(name: 'users')
class User {
  Id dbId = autoIncrement;

  @Index()
  late String email;

  late String name;
}

Use the generated schema and typed collection API:

import 'package:cindel/cindel.dart';

import 'user.dart';

Future<void> main() async {
  final db = await Cindel.open(
    directory: 'app_data',
    schemas: [UserSchema],
  );

  final user = User()
    ..email = 'jhon@example.com'
    ..name = 'Jhon Doe';

  await db.users.put(user);

  final matches = await db.users
      .where()
      .emailEqualTo('jhon@example.com')
      .findAll();

  print('Found ${matches.length} user(s).');

  await db.close();
}

Generate the code before running the app:

dart run build_runner build --delete-conflicting-outputs
3
likes
155
points
869
downloads

Documentation

Documentation
API reference

Publisher

unverified uploader

Weekly Downloads

Generated typed local database for Flutter and Dart apps with MDBX, SQLite, and SQLite Web/OPFS backends.

Repository (GitHub)
View/report issues
Contributing

Topics

#database #nosql #storage #cindel #flutter

License

Apache-2.0 (license)

Dependencies

cindel_annotations, ffi, hooks, native_toolchain_rust, web

More

Packages that depend on cindel