$if<T> function

BaseBLoCWidget<T> $if<T>(
  1. LiveData<T> lv, {
  2. bool condition(
    1. T value
    )?,
  3. Key? key,
  4. required Widget build(
    1. BuildContext context,
    2. T value
    ),
})

Implementation

BaseBLoCWidget<T> $if<T>(
  LiveData<T> lv, {
  bool Function(T value)? condition,
  Key? key,
  required Widget Function(BuildContext context, T value) build,
}) {
  condition ??= (T v) {
    if (v is bool) return v;
    return false;
  };
  return $when<T>(lv) | $case<T>(condition, build: build);
}