sqlcool 1.0.0+1 copy "sqlcool: ^1.0.0+1" to clipboard
sqlcool: ^1.0.0+1 copied to clipboard

outdated

A Flutter library to work with Sqflite. Provide helpers for crud operations.

Sqlcool #

A database helper class for Sqflite: forget about implementation details and focus on the business logic

Check the documentation for usage instructions

Quick example #

import 'package:sqlcool/sqlcool.dart';

void someFunc() async {
   String dbpath = "db.sqlite"; // relative to the documents directory
   await db.init(path: dbpath, fromAsset: "assets/db.sqlite", verbose: true).catchError((e) {
       print("Error initializing the database: ${e.message}");
   });
   // insert
   Map<String, String> row = {
    slug: "my-item",
    name: "My item",
   };
   db.insert(table: "category", row: row, verbose: true).catchError((e) {
       print("Error inserting data: ${e.message}");
   });
   // select
   List<Map<String, dynamic>> rows = await db.select(
     table: "product", limit: 20, columns: "id,name",
     where: "name LIKE '%something%'",
     orderBy: "name ASC").catchError((e) {
       print("Error selecting data: ${e.message}");
   });
   //update
   Map<String, String> row = {
    slug: "my-item-new",
    name: "My item new",
   };
   int updated = await db.update(table: "category", 
       row: row, where: "id=1", verbose: true).catchError((e) {
          print("Error updating data: ${e.message}");
   });
   // delete
   db.delete(table: "category", where: "id=3").catchError((e) {
       print("Error deleting data: ${e.message}");
   });
}

Todo #

  • Upsert
  • Batch operations
42
likes
0
pub points
34%
popularity

Publisher

unverified uploader

A Flutter library to work with Sqflite. Provide helpers for crud operations.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

cupertino_icons, flutter, path_provider, sqflite, synchronized

More

Packages that depend on sqlcool