harndb 0.1.3 copy "harndb: ^0.1.3" to clipboard
harndb: ^0.1.3 copied to clipboard

a simple key-value non-relational database engine for dart.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:harndb/harndb.dart';
import 'package:harndb_example/data.dart';

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  db.initialize();
  runApp(const MyApp());
}

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  @override
  void initState() {
    super.initState();
  }

  void deleteCollections() async {
    // final list = await db.listCollectionNames();
    // list.forEach((element) {
    //   db.deleteCollection(element);
    //   print(element);
    // });
  }

  void test() async {
    User firstUser = User(id: HarnUtils.generateId(), name: "Andress", age: 33);
    await users.insert(firstUser);
    print(users.find());
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Column(
          children: [
            Container(
              height: 20,
            ),
            ElevatedButton(onPressed: test, child: const Text("test")),
            Container(
              height: 20,
            ),
          ],
        ),
      ),
    );
  }
}
4
likes
0
points
24
downloads

Publisher

unverified uploader

Weekly Downloads

a simple key-value non-relational database engine for dart.

Homepage

License

unknown (license)

Dependencies

flutter, path_provider, plugin_platform_interface

More

Packages that depend on harndb