# Patch operation

Canonical page: https://docs.ovok.com/flutter-sdk/reference/ovok_sdk/patch-operation

{/* Generated by scripts/generate_reference.dart; do not edit. */}

## PatchOperation [#patchoperation]

```dart
class PatchOperation
```

One JSON Patch (RFC 6902) operation; `value` is sent even when it is null.

### Constructors [#constructors]

#### PatchOperation.add [#patchoperationadd]

```dart
PatchOperation.add(String path, Object? value)
```

Adds `value` at `path`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `path` | `String` | positional |  |
| `value` | `Object?` | positional |  |

#### PatchOperation.remove [#patchoperationremove]

```dart
PatchOperation.remove(String path)
```

Removes the value at `path`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `path` | `String` | positional |  |

#### PatchOperation.replace [#patchoperationreplace]

```dart
PatchOperation.replace(String path, Object? value)
```

Replaces the value at `path` with `value`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `path` | `String` | positional |  |
| `value` | `Object?` | positional |  |

#### PatchOperation.copy [#patchoperationcopy]

```dart
PatchOperation.copy({required String from, required String path})
```

Copies the value at `from` to `path`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `from` | `String` | required named |  |
| `path` | `String` | required named |  |

#### PatchOperation.move [#patchoperationmove]

```dart
PatchOperation.move({required String from, required String path})
```

Moves the value at `from` to `path`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `from` | `String` | required named |  |
| `path` | `String` | required named |  |

#### PatchOperation.test [#patchoperationtest]

```dart
PatchOperation.test(String path, Object? value)
```

Fails the patch unless the value at `path` equals `value`.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `path` | `String` | positional |  |
| `value` | `Object?` | positional |  |

### Methods [#methods]

#### PatchOperation.toJson [#patchoperationtojson]

```dart
Map<String, Object?> toJson()
```

The operation as its JSON Patch object.

Returns `Map<String, Object?>`.
