ConnectionBuilder constructor

ConnectionBuilder({
  1. Key? key,
  2. ConnectionBloc? bloc,
  3. WidgetBuilder? onOnline,
  4. WidgetBuilder? onOffline,
})

Implementation

ConnectionBuilder({
  super.key,
  super.bloc,
  WidgetBuilder? onOnline,
  WidgetBuilder? onOffline,
}) : super(
        builder: (BuildContext context, Connection state) {
          switch (state) {
            case Connection.online:
              return onOnline?.call(context) ?? const SizedBox.shrink();
            case Connection.offline:
              return onOffline?.call(context) ?? const SizedBox.shrink();
          }
        },
      );