capitalize method

  1. @useResult
String capitalize()

Capitalizes the first character.

'abc'.capitalize(); // 'Abc'

'abC'.capitalize(); // 'AbC'

''.capitalize(); // ''

Implementation

@useResult String capitalize() => isEmpty ? this : this[0].toUpperCase() + substring(1);