String convertToHalfWidth(String text) { return text.replaceAllMapped( RegExp(r'[0-9a-zA-Z]'), (m) => String.fromCharCode(m[0]!.codeUnitAt(0) - 65248), ); }