buildWhen<TState> method Null safety

Widget buildWhen<TState>(
  1. bool condition(
    1. TState prev,
    2. TState next
    ),
  2. Widget builder(
    1. BuildContext context,
    2. TCubit cubix
    ),
  3. {Object? family,
  4. bool transient = false}
)

Implementation

Widget buildWhen<TState>(
  bool Function(TState prev, TState next) condition,
  Widget Function(BuildContext context, TCubit cubix) builder, {
  Object? family,

  /// remove cubix automatically when the widget is disposed
  bool transient = false,
}) {
  return CubixBuilder<TCubit>(
    create: this,
    buildWhen: (prev, next) => condition(
      (prev as CubixState<TState>).state,
      (next as CubixState<TState>).state,
    ),
    builder: builder,
    family: family,
    transient: transient,
  );
}