LazxListener constructor
LazxListener({
- required LazxState data,
- LazxListenerBuilder? initial,
- LazxListenerBuilder? loading,
- LazxListenerBuilder? success,
- LazxListenerBuilder? error,
Implementation
LazxListener(
{required this.data,
this.initial,
this.loading,
this.success,
this.error}) {
/// We listen to the data's state and calling the right listener builder
/// function
data.state.listen((state) {
switch (state) {
case LxState.Initial:
initial?.call(state);
break;
case LxState.Loading:
loading?.call(state);
break;
case LxState.Success:
success?.call(state);
break;
case LxState.Error:
error?.call(state);
break;
}
});
}