insert method

Future insert(
  1. List<ShopInfo> list
)

写入数据

Implementation

Future insert(List<ShopInfo> list) async {
  Database db = await getDatabase();
  var batch = db.batch();

  /// 循环插入
  list.forEach((e) => batch.insert(
        tableName(),
        e.toJson(),
        conflictAlgorithm: ConflictAlgorithm.replace,
      ));

  /// 提交事务
  return await batch.commit();
}