afterLoad method

Widget afterLoad({
  1. required dynamic child(),
  2. Widget? placeholder,
  3. String? loadingKey,
})

The afterLoad 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 afterLoad(
    {required Function() child, Widget? placeholder, String? loadingKey}) {
  if (isLoading(name: loadingKey ?? "default")) {
    Nylo nylo = Backpack.instance.read('nylo');
    return placeholder ?? nylo.appLoader;
  }
  return child();
}