Skip to content

Commit

Permalink
fix empty string issue
Browse files Browse the repository at this point in the history
  • Loading branch information
moovida committed Nov 26, 2024
1 parent 4b7ad04 commit c346cd9
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion lib/com/hydrologis/flutterlibs/forms/forms_widgets.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1064,9 +1064,27 @@ class ComboboxWidgetState<T> extends State<ComboboxWidget> {
}
}

bool isInt = widget._formItem.type == TYPE_INTCOMBO;

T? value;
if (widget._formItem.value != null) {
value = widget._formItem.value;
try {
if (isInt && widget._formItem.value is String) {
if (widget._formItem.value.isEmpty) {
value = null;
} else {
value = int.parse(widget._formItem.value) as T;
}
} else {
value = widget._formItem.value;
}
} on TypeError catch (er, st) {
print(er);
SMLogger()
.e("Error parsing value: ${widget._formItem.value}", null, st);
} on Exception catch (e, st) {
SMLogger().e("Error parsing value: ${widget._formItem.value}", e, st);
}
}
String? key = widget._formItem.key;

Expand Down

0 comments on commit c346cd9

Please sign in to comment.