insert method

Future<StorageOperator> insert (StorageOperator operator)

Implementation

Future<StorageOperator> insert(StorageOperator operator) async {
  Database db = await this.db;
  try {
    operator._id = await db.insert(this.tableName, operator.toMap());
    return operator;
  } catch (e) {
    await this
        .close(); //Performing close in catch as it needs to be awaited for. Finally block needs to be synchronous.
    throw new Exception(e);
  }
}