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) {
switch (state) {
case Connection.online:
return onOnline?.call(context);
case Connection.offline:
return onOffline?.call(context);
}
},
);