asString method

  1. @override
String asString()
override

Implementation

@override
String asString() {
  var ret = _arg.toString();

  if (options['precision'] > -1 && options['precision'] <= ret.length) {
    ret = ret.substring(0, options['precision']);
  }

  if (options['width'] > -1) {
    int diff = (options['width'] - ret.length);

    if (diff > 0) {
      var padding = Formatter.get_padding(diff, options['padding_char']);
      if (!options['left_align']) {
        ret = '${padding}${ret}';
      } else {
        ret = '${ret}${padding}';
      }
    }
  }
  return ret;
}