kvsql 0.1.0 copy "kvsql: ^0.1.0" to clipboard
kvsql: ^0.1.0 copied to clipboard

outdated

A key/value store backed by Sqlite. It has methods to handle high throughput updates.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:kvsql/kvsql.dart';
import 'conf.dart';
import 'simple.dart';
import 'push.dart';
import 'in_memory.dart';

final routes = {
  '/': (BuildContext context) => Home(),
  '/simple': (BuildContext context) => Simple(),
  '/push': (BuildContext context) => PushPage(),
  '/in_memory': (BuildContext context) => InMemoryPage(),
};

class _HomeState extends State<Home> {
  bool ready = false;

  @override
  void initState() {
    store = KvStore(verbose: true);
    store.onReady.then((dynamic _) => setState(() => ready = true));
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    Widget w;
    w = Scaffold(
        body: ready
            ? Center(
                child: Column(
                    mainAxisAlignment: MainAxisAlignment.center,
                    children: <Widget>[
                    RaisedButton(
                        child: const Text("Simple"),
                        onPressed: () =>
                            Navigator.of(context).pushNamed("/simple")),
                    const Padding(padding: EdgeInsets.only(bottom: 15.0)),
                    RaisedButton(
                        child: const Text("Push"),
                        onPressed: () =>
                            Navigator.of(context).pushNamed("/push")),
                    const Padding(padding: EdgeInsets.only(bottom: 15.0)),
                    RaisedButton(
                        child: const Text("In memory"),
                        onPressed: () =>
                            Navigator.of(context).pushNamed("/in_memory")),
                  ]))
            : w = const Center(child: CircularProgressIndicator()));
    return w;
  }
}

class Home extends StatefulWidget {
  @override
  _HomeState createState() => _HomeState();
}

void main() => runApp(MyApp());

class MyApp extends StatelessWidget {
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      title: 'Kvsql example',
      routes: routes,
    );
  }
}
0
likes
0
pub points
0%
popularity

Publisher

unverified uploader

A key/value store backed by Sqlite. It has methods to handle high throughput updates.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

cupertino_icons, flutter, path_provider, pedantic, sqlcool

More

Packages that depend on kvsql