arrayUnion method

Future<void> arrayUnion({
  1. required String field,
  2. required List elements,
  3. String? docId,
})

update field realtime value tells the server to union the given elements with any array value that already exists on the server.

Implementation

Future<void> arrayUnion({
  required String field,
  required List<dynamic> elements,
  String? docId,
}) async {
  return await this
      .update(docId: docId, data: {field: FieldValue.arrayUnion(elements)});
}