getWorkBenchData function
dynamic
getWorkBenchData(
- Map _workBench,
- dynamic key,
- dynamic value,
- dynamic otherInputText,
- dynamic _answeredCount,
- dynamic otherInput,
- dynamic isPhoneInput,
- dynamic phoneValue,
Implementation
getWorkBenchData(
Map<dynamic, dynamic> _workBench,
key,
value,
otherInputText,
_answeredCount,
otherInput,
isPhoneInput,
phoneValue,
) {
if (value == null) {
if (_workBench[key] != null && _workBench['${key}_phone'] != null) {
_workBench.remove(key);
_workBench.remove('${key}_phone');
}
if (_workBench[key] != null && _workBench['${key}_other'] != null) {
_workBench.remove(key);
_workBench.remove('${key}_other');
}
if (_workBench[key] != null) {
_workBench.remove(key);
}
}
if (value != null) {
_answeredCount += 1;
if (otherInput == true) {
var _newMap = {..._workBench};
_newMap[key] = value;
_newMap['${key}_other'] = otherInputText;
_workBench = _newMap;
} else if (isPhoneInput) {
var _newMap = {..._workBench};
_newMap[key] = value;
_newMap['${key}_phone'] = phoneValue;
_workBench = _newMap;
} else {
_workBench[key] = value;
}
}
return _workBench;
}