Skip to content

Commit eb2ffa6

Browse files
committed
Upgraded to latest file_picker - adds withReadStream option for processing large files
1 parent ddfb895 commit eb2ffa6

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

lib/src/fields/form_builder_file_picker.dart

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,10 @@ class FormBuilderFilePicker extends FormBuilderField<List<PlatformFile>> {
4141
/// which can be useful if you are picking it for server upload or similar.
4242
final bool withData;
4343

44+
/// If [withReadStream] is set, picked files will have its byte data available as a [Stream<List<int>>]
45+
/// which can be useful for uploading and processing large files.
46+
final bool withReadStream;
47+
4448
FormBuilderFilePicker({
4549
//From Super
4650
Key key,
@@ -57,6 +61,7 @@ class FormBuilderFilePicker extends FormBuilderField<List<PlatformFile>> {
5761
FocusNode focusNode,
5862
this.maxFiles,
5963
this.withData = false,
64+
this.withReadStream = false,
6065
this.allowMultiple = true,
6166
this.previewImages = true,
6267
this.selector = const Icon(Icons.add_circle),
@@ -155,6 +160,7 @@ class _FormBuilderFilePickerState
155160
onFileLoading: widget.onFileLoading,
156161
allowMultiple: widget.allowMultiple,
157162
withData: widget.withData,
163+
withReadStream: widget.withReadStream,
158164
);
159165
} else {
160166
throw Exception('Storage Permission not granted');

pubspec.lock

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,7 @@ packages:
168168
name: file_picker
169169
url: "https://pub.dartlang.org"
170170
source: hosted
171-
version: "2.0.13"
171+
version: "2.1.0"
172172
flutter:
173173
dependency: "direct main"
174174
description: flutter

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ dependencies:
1818
date_range_picker: ^1.0.6
1919
datetime_picker_formfield: ^1.0.0
2020
dropdown_search: ^0.4.8
21-
file_picker: ^2.0.13
21+
file_picker: ^2.1.0
2222
flutter_colorpicker: ^0.3.4
2323
flutter_chips_input: ^1.9.4
2424
flutter_datetime_picker: ^1.4.0

0 commit comments

Comments
 (0)