insertMany abstract method

Future<List<InstanceType>> insertMany(
  1. List<InstanceType> objects
)

Inserts an InstanceTypes into the underlying database.

The Query must not have its values nor valueMap property set. This operation will insert a row for each item in objects to the database in context. The return value is a Future that completes with the newly inserted InstanceTypes. Example:

  final users = [
     User()..email = 'user1@example.dev',
     User()..email = 'user2@example.dev',
  ];
  final q = Query<User>();
  var newUsers = await q.insertMany(users);

If the InstanceType has properties with Validate metadata, those validations will be executed prior to sending the query to the database.

The method guaranties that either all rows will be inserted and returned or exception will be thrown and non of the rows will be written to the database.

Implementation

Future<List<InstanceType>> insertMany(List<InstanceType> objects);