Result policy
Generated reference for ovok_flutter: result policy.
- Stable unknown
- Release candidate since 0.1.0-rc.4
- Development since 0.1.0-dev.27+7d4ccf0
ReadingPolicy
typedef ReadingPolicy = bool Function(Map<String, dynamic>)Tests whether an individual measurement should be kept.
ResultPolicy
typedef ResultPolicy = bool Function(Map<String, dynamic>) Function()Creates fresh reading state for one device connection.
dailyTotalsOnly
ReadingPolicy dailyTotalsOnly()Keeps the first closed-day activity total of each type in a connection.
everyReading
ReadingPolicy everyReading()Keeps every measurement.
firstReadingPerKind
ReadingPolicy firstReadingPerKind()Keeps only the first reading of each measurement type per connection.
keepReadings
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
ResultPolicy policyByKind(Map<String, ResultPolicy> policies, {ResultPolicy? fallback})Selects a 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 |
Last updated on