getUILoadingType function

UILoadingType? getUILoadingType(
  1. dynamic type
)

Implementation

UILoadingType? getUILoadingType(dynamic type) {
  if (type == null) return null;

  if (type is UILoadingType) return type;

  var typeStr = type.toString().trim().toLowerCase();

  switch (typeStr) {
    case 'ring':
      return UILoadingType.ring;
    case 'dualRing':
      return UILoadingType.dualRing;
    case 'roller':
      return UILoadingType.roller;
    case 'spinner':
      return UILoadingType.spinner;
    case 'ripple':
      return UILoadingType.ripple;
    case 'blocks':
      return UILoadingType.blocks;
    case 'ellipsis':
      return UILoadingType.ellipsis;
    default:
      return null;
  }
}