getSexFromIdentityCard property
String
get
getSexFromIdentityCard
根据身份证获取性别
Implementation
String get getSexFromIdentityCard {
String sex = "";
if (!this.isIdentityCard) {
return sex;
}
if (this.length == 18) {
if (int.parse(this.substring(16, 17)) % 2 == 1) {
sex = "男";
} else {
sex = "女";
}
} else if (this.length == 15) {
if (int.parse(this.substring(14, 15)) % 2 == 1) {
sex = "男";
} else {
sex = "女";
}
}
return sex;
}