ConnectionListener constructor
ConnectionListener({
- Key? key,
- ConnectionBloc? bloc,
- Widget? child,
- ConnectionCallback? onOnline,
- ConnectionCallback? onOffline,
Implementation
ConnectionListener({
super.key,
super.bloc,
super.child,
ConnectionCallback? onOnline,
ConnectionCallback? onOffline,
}) : super(
listenWhen: (Connection previous, Connection current) =>
previous != current,
listener: (BuildContext context, Connection state) {
return switch (state) {
Connection.online => onOnline?.call(context),
Connection.offline => onOffline?.call(context),
};
},
);