buildForm method

FormGroup buildForm(
  1. BeneficiaryRegistrationState state
)

Implementation

FormGroup buildForm(BeneficiaryRegistrationState state) {
  return fb.group(<String, Object>{
    _noOfRoomsKey: FormControl<int>(
        value: state.householdModel?.additionalFields?.fields
                    .where((h) =>
                        h.key == AdditionalFieldsType.noOfRooms.toValue())
                    .firstOrNull
                    ?.value !=
                null
            ? int.tryParse(state.householdModel?.additionalFields?.fields
                    .where((h) =>
                        h.key == AdditionalFieldsType.noOfRooms.toValue())
                    .firstOrNull
                    ?.value
                    .toString() ??
                '1')
            : 1),
    _householdStructureKey: FormControl<List<String>>(
      value: state.householdModel?.additionalFields?.fields
          .where((e) =>
              e.key == AdditionalFieldsType.houseStructureTypes.toValue())
          .first
          .value
          .toString()
          .split("|"),
    )
  });
}