ConvertComputed<T, U> constructor

ConvertComputed<T, U>(
  1. Signal<U> source, {
  2. required T decode(
    1. U value
    ),
  3. required U encode(
    1. T value
    ),
  4. JoltDebugFn? onDebug,
})

Creates a type-converting computed signal.

Parameters:

  • source: The source signal to convert from
  • decode: Function to convert from source type to target type
  • encode: Function to convert from target type to source type
  • onDebug: Optional debug callback for reactive system debugging

Example:

final convertComputed = ConvertComputed(
  count,
  decode: (int v) => v.toString(),
  encode: (String v) => int.parse(v),
);

Implementation

factory ConvertComputed(Signal<U> source,
    {required T Function(U value) decode,
    required U Function(T value) encode,
    JoltDebugFn? onDebug}) = ConvertComputedImpl<T, U>;