skeletonData<T> method

T skeletonData<T>({
  1. required T? realData,
  2. required T busyData,
  3. Object? busyKey,
})
inherited

returns real data passed if neither the model is busy nor the object passed is busy

Implementation

T skeletonData<T>(
    {required T? realData, required T busyData, Object? busyKey}) {
  /// If busyKey is supplied we check busy(busyKey) to see if that property is busy
  /// If it is we return busyData, else realData
  bool isBusyKeySupplied = busyKey != null;
  if ((isBusyKeySupplied && busy(busyKey)) || realData == null) {
    return busyData;
  } else if (!isBusyKeySupplied && isBusy) {
    return busyData;
  }

  return realData;
}