bulkCreate method

  1. @override
FutureOr<void> bulkCreate(
  1. List<HFReferralModel> entities
)
override

Implementation

@override
FutureOr<void> bulkCreate(
  List<HFReferralModel> entities,
) async {
  return retryLocalCallOperation(() async {
    final referralCompanions = entities
        .map((e) => e.companion.copyWith(
              name: e.additionalFields?.fields
                  .where((h) =>
                      h.key ==
                      ReferralReconAdditionalFields.nameOfReferral.toValue())
                  .first
                  .value,
            ))
        .toList();

    await sql.batch((batch) async {
      batch.insertAll(
        sql.hFReferral,
        referralCompanions,
        mode: InsertMode.insertOrReplace,
      );
    });
  });
}