ifBusy method Null safety

Widget ifBusy(
  1. Widget busyIndicator,
  2. {required Widget otherwise}
)

Can be used to conditionally show another widget if the viewModel is busy running a long running task.

If the view model is busy, it will show the busyIndicator widget. If it is not busy, it will show the otherwise widget.

Implementation

Widget ifBusy(Widget busyIndicator, {required Widget otherwise}) {
  return isBusy ? busyIndicator : otherwise;
}