afterNotNull method

Widget afterNotNull(
  1. dynamic variable, {
  2. required dynamic child(),
  3. Widget? loading,
})

The afterNotNull method will check if the variable passed in is null If the variable is not null, it will display the loading widget.

Implementation

Widget afterNotNull(dynamic variable,
    {required Function() child, Widget? loading}) {
  if (variable == null) {
    return loading ?? Nylo.appLoader();
  }
  return child();
}