Write.fromJson constructor

Write.fromJson(
  1. Object? j
)

Implementation

factory Write.fromJson(Object? j) {
  final json = j as Map<String, Object?>;
  return Write(
    update: switch (json['update']) {
      null => null,
      Object $1 => Document.fromJson($1),
    },
    delete: switch (json['delete']) {
      null => null,
      Object $1 => decodeString($1),
    },
    transform: switch (json['transform']) {
      null => null,
      Object $1 => DocumentTransform.fromJson($1),
    },
    updateMask: switch (json['updateMask']) {
      null => null,
      Object $1 => DocumentMask.fromJson($1),
    },
    updateTransforms: switch (json['updateTransforms']) {
      null => [],
      List<Object?> $1 => [
        for (final i in $1) DocumentTransform_FieldTransform.fromJson(i),
      ],
      _ => throw const FormatException('"updateTransforms" is not a list'),
    },
    currentDocument: switch (json['currentDocument']) {
      null => null,
      Object $1 => Precondition.fromJson($1),
    },
  );
}