# Result policy

Canonical page: https://docs.ovok.com/flutter-sdk/reference/ovok_flutter/result-policy

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

## ReadingPolicy [#readingpolicy]

```dart
typedef ReadingPolicy = bool Function(Map<String, dynamic>)
```

Tests whether an individual measurement should be kept.


## ResultPolicy [#resultpolicy]

```dart
typedef ResultPolicy = bool Function(Map<String, dynamic>) Function()
```

Creates fresh reading state for one device connection.


## dailyTotalsOnly [#dailytotalsonly]

```dart
ReadingPolicy dailyTotalsOnly()
```

Keeps the first closed-day activity total of each type in a connection.


## everyReading [#everyreading]

```dart
ReadingPolicy everyReading()
```

Keeps every measurement.


## firstReadingPerKind [#firstreadingperkind]

```dart
ReadingPolicy firstReadingPerKind()
```

Keeps only the first reading of each measurement type per connection.


## keepReadings [#keepreadings]

```dart
Stream<BluetoothDeviceEvent> keepReadings(Stream<BluetoothDeviceEvent> events, ResultPolicy policy)
```

Filters a driver's events while preserving statuses and recoverable errors.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `events` | `Stream<BluetoothDeviceEvent>` | positional |  |
| `policy` | `ResultPolicy` | positional |  |


## policyByKind [#policybykind]

```dart
ResultPolicy policyByKind(Map<String, ResultPolicy> policies, {ResultPolicy? fallback})
```

Selects a [`ResultPolicy`](#resultpolicy) per measurement type and uses `fallback` otherwise.

| Parameter | Type | Kind | Default |
| ------ | ------ | ------ | ------ |
| `policies` | `Map<String, bool Function(Map<String, dynamic>) Function()>` | positional |  |
| `fallback` | `ResultPolicy?` | named |  |
