File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -825,7 +825,7 @@ Have a look at the example application for a small (non web) example.
825825
826826
827827``` dart
828- //A short example
828+ //A short example for showing an image from a ParseFileBase
829829Widget buildImage(ParseFileBase image){
830830 return FutureBuilder<ParseFileBase>(
831831 future: image.download(),
@@ -844,6 +844,23 @@ Widget buildImage(ParseFileBase image){
844844 );
845845}
846846```
847+ ``` dart
848+ //A short example for storing a selected picture
849+ //libraries: image_picker (https://pub.dev/packages/image_picker), image_picker_for_web (https://pub.dev/packages/image_picker_for_web)
850+ PickedFile pickedFile = await ImagePicker().getImage(source: ImageSource.gallery);
851+ ParseFileBase parseFile;
852+ if (kIsWeb) {
853+ //Seems weird, but this lets you get the data from the selected file as an Uint8List very easily.
854+ ParseWebFile file = ParseWebFile(null, name: null, url: pickedFile.path);
855+ await file.download();
856+ parseFile = ParseWebFile(file.file, name: file.name);
857+ } else {
858+ parseFile = ParseFile(File(pickedFile.path));
859+ }
860+ someParseObject.set("image", parseFile);
861+ //This saves the ParseObject as well as all of its children, and the ParseFileBase is such a child.
862+ await someParseObject.save();
863+ ```
847864
848865## Other Features of this library
849866Main:
You can’t perform that action at this time.
0 commit comments