format method
This method will format a given CPF, that should be a String
Usage:
final cpf = CPFUtil();
// This will validate a given CPF (Must be a String)
print(cpf.format('35275302827')); // -> '352.753.028-27'
Implementation
@override
String format(String cpf) {
if (cpf.length != 11) throw InvalidCPFError();
final elements = cpf.split('');
elements.insert(3, '.');
elements.insert(7, '.');
elements.insert(11, '-');
return elements.reduce((a, b) => a += b);
}