ConvertComputed<T, U> constructor
ConvertComputed<T, U> (
- Signal<
U> source, { - required T decode(
- U value
- required U encode(
- T value
- T? initialValue,
- JoltDebugFn? onDebug,
Creates a type-converting computed signal.
Parameters:
source: The source signal to convert fromdecode: Function to convert from source type to target typeencode: Function to convert from target type to source typeinitialValue: Optional initial value for the computedonDebug: Optional debug callback
Implementation
ConvertComputed(this.source,
{required this.decode,
required this.encode,
super.initialValue,
super.onDebug})
: super(
() => decode(source.value),
(value) => source.value = encode(value),
);