Skip to content

add an other file example to README #410

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -825,7 +825,7 @@ Have a look at the example application for a small (non web) example.


```dart
//A short example
//A short example for showing an image from a ParseFileBase
Widget buildImage(ParseFileBase image){
return FutureBuilder<ParseFileBase>(
future: image.download(),
Expand All @@ -844,6 +844,23 @@ Widget buildImage(ParseFileBase image){
);
}
```
```dart
//A short example for storing a selected picture
//libraries: image_picker (https://pub.dev/packages/image_picker), image_picker_for_web (https://pub.dev/packages/image_picker_for_web)
PickedFile pickedFile = await ImagePicker().getImage(source: ImageSource.gallery);
ParseFileBase parseFile;
if (kIsWeb) {
//Seems weird, but this lets you get the data from the selected file as an Uint8List very easily.
ParseWebFile file = ParseWebFile(null, name: null, url: pickedFile.path);
await file.download();
parseFile = ParseWebFile(file.file, name: file.name);
} else {
parseFile = ParseFile(File(pickedFile.path));
}
someParseObject.set("image", parseFile);
//This saves the ParseObject as well as all of its children, and the ParseFileBase is such a child.
await someParseObject.save();
```

## Other Features of this library
Main:
Expand Down