toggleCase property

String get toggleCase

Returns String as case toggled for each characters.

final str = "Hello tHere peOple";
str.toggleCase;  // hELLO ThERE PEoPLE

Implementation

String get toggleCase => characters
    .map((e) => e.toUpperCase() == e ? e.toLowerCase() : e.toUpperCase())
    .join();