Skip to content

Commit

Permalink
Added a null-safe spread operator for field.value to guard against a …
Browse files Browse the repository at this point in the history
…null value. Resolves flutter-form-builder-ecosystem#607.
  • Loading branch information
awhitford committed Dec 2, 2020
1 parent d4f862d commit 84f254e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions lib/src/fields/form_builder_image_picker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class FormBuilderImagePicker extends FormBuilderField<List<dynamic>> {
onTap: () {
state.requestFocus();
field.didChange(
<dynamic>[...field.value]..remove(item));
<dynamic>[...?field.value]..remove(item));
},
child: Container(
margin: const EdgeInsets.all(3),
Expand Down Expand Up @@ -184,12 +184,12 @@ class FormBuilderImagePicker extends FormBuilderField<List<dynamic>> {
onImageSelected: (image) {
state.requestFocus();
field.didChange(
<dynamic>[...field.value, image]);
<dynamic>[...?field.value, image]);
Navigator.pop(state.context);
},
onImage: (image) {
field.didChange(
<dynamic>[...field.value, image]);
<dynamic>[...?field.value, image]);
onChanged?.call(field.value);
Navigator.pop(state.context);
},
Expand Down

0 comments on commit 84f254e

Please sign in to comment.