convertSnakeToMixed static method

String convertSnakeToMixed(
  1. String convert, {
  2. bool upcaseFirst = false,
})

Implementation

static String convertSnakeToMixed(String convert, { bool upcaseFirst = false } ) {
  final sb = StringBuffer();
  var shouldUpcase = upcaseFirst;
  for(var i = 0; i < convert.length; i++) {
    var c = convert[i];
    if(shouldUpcase) {
      c = c.toUpperCase();
    }
    if(c != "_") {
      sb.write(c);
      shouldUpcase = false;
    } else {
      shouldUpcase = true;
    }
  }
  return sb.toString();
}