formatGpsCode function
"GA1838164" or "ga-183-8164" → "GA-183-8164". Anything else comes back upper-cased.
Implementation
String formatGpsCode(String code) {
final c = code.toUpperCase().replaceAll(RegExp('[^A-Z0-9]'), '');
final m = RegExp(r'^([A-Z]{2})(\d{3,4})(\d{4})$').firstMatch(c);
return m == null ? code.toUpperCase() : '${m[1]}-${m[2]}-${m[3]}';
}