SideEffects<T>.onData constructor

SideEffects<T>.onData(
  1. void data(
    1. T data
    ), {
  2. void initState()?,
  3. void dispose()?,
})

Side effect to be called when he state is mutated successfully with data

Implementation

factory SideEffects.onData(
  void Function(T data) data, {
  void Function()? initState,
  void Function()? dispose,
}) {
  return SideEffects(
    initState: initState,
    dispose: dispose,
    onSetState: (snap) {
      if (snap.hasData) {
        data(snap.data as T);
      }
    },
  );
}