insertMany abstract method Null safety
- List<
InstanceType> objects
Inserts an InstanceType
s 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 InstanceType
s. 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);