toString method
Returns string representation of CountryCode
.
Which is CountryCode.
followed by either alpha-2, alpha-2, or numeric code
depeding on which code is defined.
For ISO-assigned country codes it alwais returns CountryCode.
+ alpha-2.
Implementation
@override
String toString() {
// 'Country'.codeUnits + 3
const cu = <int>[67, 111, 117, 110, 116, 114, 121, 67, 111, 100, 101, 46];
_unpackAlpha2(_code);
if (_a2cu[0] != _baseChar) {
return String.fromCharCodes(cu + _a2cu);
}
_unpackAlpha3(_code);
if (_a3cu[0] != _baseChar) {
return String.fromCharCodes(cu + _a3cu);
}
var n = _code & 0x3ff;
if (n != 0) {
return String.fromCharCodes(cu + n.toString().padLeft(3, '0').codeUnits);
}
assert(true, 'Unreachable return');
return 'Country.UNKNOWN';
}