updateDocument method

Future<void> updateDocument(
  1. String path,
  2. Document document,
  3. bool update
)

Implementation

Future<void> updateDocument(
    String path, fs.Document document, bool update) async {
  document.name = path;

  var request = UpdateDocumentRequest()..document = document;

  if (update) {
    var mask = DocumentMask();
    document.fields.keys.forEach(mask.fieldPaths.add);
    request.updateMask = mask;
  }

  await _client.updateDocument(request).catchError(_handleError);
}