format static method

String format(
  1. String cpf
)

Implementation

static String format(String cpf) {
  RegExp regExp = RegExp(r'^(\d{3})(\d{3})(\d{3})(\d{2})$');

  return strip(cpf).replaceAllMapped(
      regExp, (Match m) => "${m[1]}.${m[2]}.${m[3]}-${m[4]}");
}