operator [] method

String operator [](
  1. int index
)

The character (as a single-code-unit String) at the given index.

The returned string represents exactly one UTF-16 code unit, which may be half of a surrogate pair. A single member of a surrogate pair is an invalid UTF-16 string:

var clef = '\u{1D11E}';
// These represent invalid UTF-16 strings.
clef[0].codeUnits;      // [0xD834]
clef[1].codeUnits;      // [0xDD1E]

This method is equivalent to String.fromCharCode(this.codeUnitAt(index)).

Implementation

String operator [](int index) => value[index];