import 'package:flutter/material.dart'; class StringUtils { StringUtils._init(); static StringUtils? _instance; static StringUtils get instance => _instance ??= StringUtils._init(); List parseAddressFromMapAPI(String addressString) { RegExp regex = RegExp(r'([^<]+)'); List textSpans = []; Iterable matches = regex.allMatches(addressString); for (Match match in matches) { String cssClass = match.group(1)!; String text = match.group(2)!; if (cssClass == 'country-name') { continue; } textSpans.add( TextSpan( text: text, ), ); textSpans.add( const TextSpan(text: ', '), ); } textSpans.removeLast(); return textSpans; } }