gender property Null safety

Gender gender

User's gender.

Implementation

Gender get gender {
  switch (_userData['gender']) {
    case "m":
      return Gender.male;
    case "f":
      return Gender.female;
    case "o":
      return Gender.other;
    default:
      return Gender.unknown;
  }
}
void gender=(Gender gender)

Implementation

set gender(Gender gender) {
  var code = "u";
  switch (gender) {
    case Gender.other:
      code = "o";
      break;
    case Gender.male:
      code = "m";
      break;
    case Gender.female:
      code = "f";
      break;
    default:
      code = "u";
  }
  _userData["gender"] = code;
  _updateInstance(_userData);
}