edit method

Future<DocumentDto> edit(
  1. String collection,
  2. String id,
  3. Map<String, dynamic> data
)

Updates one document.

id is required. It used to be nullable, and documentUrl omits a null segment, so edit(collection, null, data) quietly PATCHed the collection endpoint instead of a document.

Implementation

Future<DocumentDto> edit(
  String collection,
  String id,
  Map<String, dynamic> data,
) async {
  final json = asJsonObject(
    await http.patch(documentUrl(collection, id), data),
    'An edited document',
  );
  return DocumentDto.fromJson(json);
}