Skip to content

Commit

Permalink
Fix example in MulitpartRequest docs (flutter#250)
Browse files Browse the repository at this point in the history
Fixes flutter#140

- `MultipartFile.fromFile` does not exist, update to `fromPath`.
- Use async/await.
- Use single quotes consistently.
  • Loading branch information
natebosch authored Mar 6, 2019
1 parent 7df1d69 commit 4464890
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions lib/src/multipart_request.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,12 @@ final _newlineRegExp = new RegExp(r"\r\n|\r|\n");
/// var uri = Uri.parse("http://pub.dartlang.org/packages/create");
/// var request = new http.MultipartRequest("POST", uri);
/// request.fields['user'] = '[email protected]';
/// request.files.add(new http.MultipartFile.fromFile(
/// request.files.add(new http.MultipartFile.fromPath(
/// 'package',
/// new File('build/package.tar.gz'),
/// 'build/package.tar.gz',
/// contentType: new MediaType('application', 'x-tar'));
/// request.send().then((response) {
/// if (response.statusCode == 200) print("Uploaded!");
/// });
/// var response = await request.send();
/// if (response.statusCode == 200) print('Uploaded!');
class MultipartRequest extends BaseRequest {
/// The total length of the multipart boundaries used when building the
/// request body. According to http://tools.ietf.org/html/rfc1341.html, this
Expand Down

0 comments on commit 4464890

Please sign in to comment.