FieldValue.arrayRemove constructor

const FieldValue.arrayRemove(
  1. List<Object?> elements
)

Returns a special value that can be used with set(), create() or update() that tells the server to remove the given elements from any array value that already exists on the server. All instances of each element specified will be removed from the array. If the field being modified is not already an array it will be overwritten with an empty array.

final documentRef = firestore.doc('col/doc');

documentRef.update({
  'array': Firestore.FieldValue.arrayRemove('foo'),
}).then(() {
  return documentRef.get();
}).then((doc) {
  // doc.get('array') no longer contains field 'foo'
});

Implementation

const factory FieldValue.arrayRemove(List<Object?> elements) =
    _ArrayRemoveTransform;