Skip to content

Commit bcfa7f0

Browse files
committed
fix: minor type and null-safe fixes after merge
1 parent 9388582 commit bcfa7f0

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

lib/src/form_builder_file_picker.dart

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ typedef FileViewerBuilder = Widget Function(
2222
);
2323

2424
/// Field for image(s) from user device storage
25-
class FormBuilderFilePicker extends FormBuilderField<List<PlatformFile>?> {
25+
class FormBuilderFilePicker extends FormBuilderField<List<PlatformFile>> {
2626
/// Maximum number of files needed for this field
2727
final int? maxFiles;
2828

@@ -128,7 +128,7 @@ class FormBuilderFilePicker extends FormBuilderField<List<PlatformFile>?> {
128128
customFileViewerBuilder != null
129129
? customFileViewerBuilder.call(state._files,
130130
(files) => state._setFiles(files ?? [], field))
131-
: state.defaultFileViewer(state._files, field),
131+
: state.defaultFileViewer(state._files, field as FormFieldState<List<PlatformFile>>),
132132
],
133133
),
134134
);
@@ -212,15 +212,13 @@ class _FormBuilderFilePickerState
212212
widget.onChanged?.call(_files);
213213
}
214214

215-
void removeFileAtIndex(int index, FormFieldState<List<PlatformFile>?> field) {
216-
setState(() {
217-
_files.removeAt(index);
218-
});
215+
void removeFileAtIndex(int index, FormFieldState<List<PlatformFile>> field) {
216+
setState(() => _files.removeAt(index));
219217
field.didChange(_files);
220218
}
221219

222220
Widget defaultFileViewer(
223-
List<PlatformFile> files, FormFieldState<List<PlatformFile>?> field) {
221+
List<PlatformFile> files, FormFieldState<List<PlatformFile>> field) {
224222
final theme = Theme.of(context);
225223

226224
return LayoutBuilder(
@@ -267,7 +265,7 @@ class _FormBuilderFilePickerState
267265
width: double.infinity,
268266
color: Colors.white.withOpacity(.8),
269267
child: Text(
270-
'${files[index].name}',
268+
files[index].name,
271269
style: theme.textTheme.caption,
272270
maxLines: 2,
273271
overflow: TextOverflow.clip,

0 commit comments

Comments
 (0)