Skip to content

Commit

Permalink
fix: boolSetting returns incorrect value when persisted value does no…
Browse files Browse the repository at this point in the history
…t equal default value (#7)
  • Loading branch information
btrautmann authored May 22, 2024
1 parent a5f47be commit 39f1fb4
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/src/beacon_settings.dart
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ Encoder<int> intEncoder() {
/// Decoder for a [Setting] that manages a [bool]. If the value is not in
/// the underlying [Storage], [defaultValue] is returned.
Decoder<bool> boolDecoder({bool defaultValue = false}) {
return (value) => (value is BoolSettingValue && value.value) || defaultValue;
return (value) => value is BoolSettingValue ? value.value : defaultValue;
}

/// Encoder for a [Setting] that manages a [bool].
Expand Down

0 comments on commit 39f1fb4

Please sign in to comment.