afterNotNull method

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

The afterNotNull method will check if the state is loading If loading it will display the placeholder widget. You can also specify the name of the loadingKey.

Implementation

Widget afterNotNull(dynamic variable,
    {required Function() child, Widget? loadingPlaceholder}) {
  if (variable == null) {
    return loadingPlaceholder ?? Backpack.instance.nylo().appLoader;
  }
  return child();
}