genderLogic<T> method Null safety

T genderLogic<T>(
  1. String targetGender,
  2. {T? female,
  3. T? male,
  4. required T other,
  5. String? locale}
)

Internal: Implements the logic for gender selection - use gender for normal messages.

Implementation

static T genderLogic<T>(String targetGender,
    {T? female, T? male, required T other, String? locale}) {
  ArgumentError.checkNotNull(other, 'other');
  switch (targetGender) {
    case 'female':
      return female == null ? other : female;
    case 'male':
      return male == null ? other : male;
    default:
      return other;
  }
}