convert<R> method

States<R> convert<R>(
  1. R convert(
    1. T
    ), {
  2. Equals<R>? equals,
})

Convert each item by applying a function and only emit result that changed.

Convert is composition of Map and Distinct.

It first transform the items emitted by applying a function, then only emit result that is distinct from previous emitted result.

Implementation

States<R> convert<R>(
  R Function(T) convert, {
  Equals<R>? equals,
}) {
  return observable
    .distinctMap<R>(
      convert,
      equals: equals,
    )
    .asStates();
}