sqlite_wrapper 0.0.6 copy "sqlite_wrapper: ^0.0.6" to clipboard
sqlite_wrapper: ^0.0.6 copied to clipboard

outdated

A simple way to easily use the SQLite library (even in a reactive way)

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:sqlite_wrapper_sample/database_helper.dart';
import 'package:sqlite_wrapper_sample/todo_list.dart';

void main() async {
  WidgetsFlutterBinding.ensureInitialized();
  // Init the DB
  await DatabaseHelper().initDB();
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({Key? key}) : super(key: key);

  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'SQLiteWrapper Sample',
      theme: ThemeData(
        primarySwatch: Colors.red,
      ),
      home: const HomePage(title: 'Todos'),
    );
  }
}

class HomePage extends StatelessWidget {
  final String title;

  const HomePage({Key? key, required this.title}) : super(key: key);
  void _addNewTodo() {
    DatabaseHelper().addNewTodo("NEW TODO");
    return;
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        // Here we take the value from the MyHomePage object that was created by
        // the App.build method, and use it to set our appbar title.
        title: Text(title),
      ),
      body: const TodoList(),
      floatingActionButton: FloatingActionButton(
        onPressed: _addNewTodo,
        tooltip: 'Add new todo',
        child: const Icon(Icons.add),
      ), // This trailing comma makes auto-formatting nicer for build methods.
    );
  }
}
7
likes
0
pub points
67%
popularity

Publisher

verified publisherbabisoft.com

A simple way to easily use the SQLite library (even in a reactive way)

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

sqlite3

More

Packages that depend on sqlite_wrapper