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

Streamline data management with DartDB is a key-value database for Dart developers. Ideal for high-performance apps, ensuring reliability and user experience.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:harndb/harnlog.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();
    harnLog.setCallback((p0) => print(p0));
  }

  void test() async {
    int i = 0;
    while (i < 500) {
      User firstUser = User(id: "id_$i", name: "Andress", age: 33);
      await users.insert(firstUser);
      i++;
    }

    final all = users.find();
    int l = 0;
    while (l < all.length) {
      print(all[l].name);
      l++;
    }
  }

  void find() {
    final all = users.find();
    int l = 0;
    while (l < all.length) {
      print("$l -> ${all[l]}");
      l++;
    }
  }

  @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,
            ),
            ElevatedButton(onPressed: find, child: const Text("find")),
          ],
        ),
      ),
    );
  }
}
4
likes
140
pub points
0%
popularity

Publisher

unverified uploader

Streamline data management with DartDB is a key-value database for Dart developers. Ideal for high-performance apps, ensuring reliability and user experience.

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, path_provider, plugin_platform_interface

More

Packages that depend on harndb