format method

String format(
  1. Object value
)

Formats the given value with the formatter.

Implementation

String format(Object value) {
  switch (formatter) {
    case NumberFormat formatter:
      return formatter.format(value as num);
    case DateFormat formatter:
      return formatter.format(value as DateTime);
    default:
      throw Exception('Unknown formatter: $formatter');
  }
}