getFormattedValue method

String? getFormattedValue()

Implementation

String? getFormattedValue(){
  if(type == NUIEntType.DATE && value is DateTime){
    if(isNullOrEmpty(formatting)){
      return dateToString(value, format: NUIDTUtil.FORMAT_dd_MMM_yyyy_hh_mm_a);
    }
    else{
      return dateToString(value, format: formatting!);
    }
  }
  else if(type == NUIEntType.DOUBLE && (value is int || value is double)){
    switch(formatting){
      case NUIFormatting.ONE_DECIMAL: return formatNumber(value, showComma: true, decimals: 1);
      case NUIFormatting.TWO_DECIMAL: return formatNumber(value, showComma: true, decimals: 2);
      case NUIFormatting.ROUNDED: return formatNumber(value, showComma: true, decimals: 0);
    }
  }
  return value.toString();
}