ordinal method
Ordinal suffix (e.g. 1st, 2nd, 3rd, 11th).
Implementation
String ordinal() {
if (this % 100 >= 11 && this % 100 <= 13) return '${this}th';
switch (this % 10) {
case 1:
return '${this}st';
case 2:
return '${this}nd';
case 3:
return '${this}rd';
default:
return '${this}th';
}
}