prettyPrint method

void prettyPrint({
  1. String prefix = '',
  2. bool useColors = true,
})

Implementation

void prettyPrint({String prefix = '', bool useColors = true}) {
  final green = useColors ? '\x1B[32m' : '';
  final red = useColors ? '\x1B[31m' : '';
  final reset = useColors ? '\x1B[0m' : '';

  if (isValid) {
    print('$prefix${green}✅ Valid$reset');
  } else {
    print('$prefix${red}❌ Invalid$reset');
    for (var i = 0; i < errors.length; i++) {
      print('$prefix  ${i + 1}. ${errors[i]}');
    }
  }
}