Skip to content

Commit 4464890

Browse files
authored
Fix example in MulitpartRequest docs (#250)
Fixes #140 - `MultipartFile.fromFile` does not exist, update to `fromPath`. - Use async/await. - Use single quotes consistently.
1 parent 7df1d69 commit 4464890

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

lib/src/multipart_request.dart

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,12 @@ final _newlineRegExp = new RegExp(r"\r\n|\r|\n");
2424
/// var uri = Uri.parse("http://pub.dartlang.org/packages/create");
2525
/// var request = new http.MultipartRequest("POST", uri);
2626
/// request.fields['user'] = '[email protected]';
27-
/// request.files.add(new http.MultipartFile.fromFile(
27+
/// request.files.add(new http.MultipartFile.fromPath(
2828
/// 'package',
29-
/// new File('build/package.tar.gz'),
29+
/// 'build/package.tar.gz',
3030
/// contentType: new MediaType('application', 'x-tar'));
31-
/// request.send().then((response) {
32-
/// if (response.statusCode == 200) print("Uploaded!");
33-
/// });
31+
/// var response = await request.send();
32+
/// if (response.statusCode == 200) print('Uploaded!');
3433
class MultipartRequest extends BaseRequest {
3534
/// The total length of the multipart boundaries used when building the
3635
/// request body. According to http://tools.ietf.org/html/rfc1341.html, this

0 commit comments

Comments
 (0)