add method

Future<void> add(
  1. Map<String, Object?> data
)

Inserts a new record into the database table.

data: A map containing the column names and values to insert.

Returns a Future that completes when the operation is done. Throws an error if the insertion fails.

Implementation

Future<void> add(Map<String, Object?> data) async {
  try {
    final db = await database;
    await db.insert(_helper.tableName, data);
  } catch (e) {
    return Future.error("Error in adding the data: $e");
  }
}