format method

String format({
  1. String? prefix,
  2. String? suffix,
})

Formats the number as a string with optional prefix and suffix.

Example:

100.format(prefix: '\$'); // '\$100'
100.format(suffix: 'px'); // '100px'

Implementation

String format({String? prefix, String? suffix}) {
  return '${prefix ?? ''}$this${suffix ?? ''}';
}