getProductUnit static method

String getProductUnit(
  1. String? unit, {
  2. String textNull = '',
  3. bool brackets = false,
})

获取物料单位

unit 单位数据 textNull 为空时展示内容 brackets 是否使用括号包裹

Implementation

static String getProductUnit(
  String? unit, {
  String textNull = '',
  bool brackets = false,
}) {
  if (unit is! String) {
    return textNull;
  } else {
    if (brackets) {
      return '($unit)';
    } else {
      return unit;
    }
  }
}