getMapGenericType property
提取 Map 类型字符串的泛型类型,返回一个 Record 类型字符串集合
Implementation
({String key, String value})? get getMapGenericType {
int start = indexOf('<') + 1;
int end = lastIndexOf('>');
if (start >= end) return null;
List<String> typeList = substring(
indexOf('<') + 1,
lastIndexOf('>'),
).split(',');
if (typeList.length != 2) return null;
return (key: typeList[0].trim(), value: typeList[1].trim());
}