easiestdb 1.0.11 copy "easiestdb: ^1.0.11" to clipboard
easiestdb: ^1.0.11 copied to clipboard

discontinued

The Easiest and Laziest approach to Flutter SQL Database. Manage Database easily.

example/main.dart

import 'package:easiestdb/easiestdb.dart';

void main() {

  // init ---
  EasiestDb.init(dbName: "Data", version: 1, dbTables: [
    DbTable("People", dbColumns: [
      DbColumn('Col 1'),
      DbColumn('Col 2'),
    ]),
    DbTable("Test", dbColumns: [
      DbColumn('Col 3'),
      DbColumn('Col 4', columnDataType: "UNIQUE"),
    ]),
  ]);

  // addData ---
  EasiestDb.addData(0, [
    Datum(1, "AAA"),
    Datum(2, "BBB"),
  ]).then((id) {
    print("ID: $id");
  });

  // getAllData ---
  EasiestDb.getAllData(0).then((listMap) {
    listMap.forEach((map) {
      print("${map.values.elementAt(0)}"); // Showing the value of the ID column
      print("${map.values.elementAt(1)}"); // Showing the value from another column
    });
  });

  // getOneRowData ---
  EasiestDb.getOneRowData(0, 7).then((listMap) {
    listMap.forEach((map) {
      print("${map.values.elementAt(0)}"); // Showing the value of the ID column
      print("${map.values.elementAt(1)}"); // Showing the value from another column
    });
  });

  // getRowsByMatchingColumnData ---
  EasiestDb.getRowsByMatchingColumnData(0, 1, 'AAA').then((listMap) {
    listMap.forEach((map) {
      print("${map.values.elementAt(0)}"); // Showing the value of the ID column
      print("${map.values.elementAt(1)}"); // Showing the value from another column
    });
  });

  // updateOneDataById ---
  EasiestDb.updateOneDataById(0, 7, [
    Datum(1, "F F F F F F "),
    Datum(2, "G G G G G G "),
  ]).then((count) {
    print("Count: $count");
  });

  // deleteOneData ---
  EasiestDb.deleteOneData(0, 7).then((val) {
    print("Count: $val");
  });

  // deleteDataBySearchingInColumn ---
  EasiestDb.deleteDataBySearchingInColumn(0, Datum(
      1, "F F F F F F "
  )).then((val) {
    print("Count: $val");
  });

  // deleteTable ---
  EasiestDb.deleteTable(1);

  // deleteDatabase ---
  EasiestDb.deleteDatabase();
}
45
likes
40
pub points
0%
popularity

Publisher

unverified uploader

The Easiest and Laziest approach to Flutter SQL Database. Manage Database easily.

Repository (GitHub)
View/report issues

License

MIT (LICENSE)

Dependencies

flutter, path, sqflite

More

Packages that depend on easiestdb