Skip to content

Commit

Permalink
Upgrade to SDK 2-dev.55 (#868)
Browse files Browse the repository at this point in the history
  • Loading branch information
chalin authored May 14, 2018
1 parent 7ac4988 commit b162ba5
Show file tree
Hide file tree
Showing 16 changed files with 32 additions and 32 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: dart
dart: 2.0.0-dev.53.0
dart: 2.0.0-dev.55.0

cache:
timeout: 300
Expand Down
2 changes: 1 addition & 1 deletion examples/httpserver/bin/basic_file_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Future main() async {
VirtualDirectory staticFiles = new VirtualDirectory('.');

var serverRequests =
await HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 4046);
await HttpServer.bind(InternetAddress.loopbackIPv4, 4046);
await for (var request in serverRequests) {
staticFiles.serveFile(targetFile, request);
}
Expand Down
2 changes: 1 addition & 1 deletion examples/httpserver/bin/basic_writer_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'dart:async';
import 'dart:io';
import 'dart:convert';

String _host = InternetAddress.LOOPBACK_IP_V4.host;
String _host = InternetAddress.loopbackIPv4.host;
String path = 'file.txt';

Map jsonData = {
Expand Down
4 changes: 2 additions & 2 deletions examples/httpserver/bin/basic_writer_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'dart:async';
import 'dart:io';
import 'dart:convert';

String _host = InternetAddress.LOOPBACK_IP_V4.host;
String _host = InternetAddress.loopbackIPv4.host;

Future main() async {
var server = await HttpServer.bind(_host, 4049);
Expand All @@ -27,7 +27,7 @@ Future main() async {
var data = jsonDecode(content) as Map; /*3*/
var fileName = req.uri.pathSegments.last; /*4*/
await new File(fileName)
.writeAsString(content, mode: FileMode.WRITE);
.writeAsString(content, mode: FileMode.write);
req.response
..statusCode = HttpStatus.OK
..write('Wrote data for ${data['name']}.');
Expand Down
2 changes: 1 addition & 1 deletion examples/httpserver/bin/hello_world_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import 'dart:async';
Future main() async {
// #docregion bind
var server = await HttpServer.bind(
InternetAddress.LOOPBACK_IP_V4,
InternetAddress.loopbackIPv4,
4040,
);
// #enddocregion bind
Expand Down
2 changes: 1 addition & 1 deletion examples/httpserver/bin/mini_file_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ Future main() async {
var server;

try {
server = await HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 4044);
server = await HttpServer.bind(InternetAddress.loopbackIPv4, 4044);
} catch (e) {
print("Couldn't bind to port 4044: $e");
exit(-1);
Expand Down
6 changes: 3 additions & 3 deletions examples/httpserver/bin/note_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ Future main() async {
return;
}

var server = await HttpServer.bind(
InternetAddress.LOOPBACK_IP_V4, 4042);
var server =
await HttpServer.bind(InternetAddress.loopbackIPv4, 4042);
print('Listening for requests on 4042.');
await listenForRequests(server);
}
Expand Down Expand Up @@ -68,7 +68,7 @@ Future handlePost(HttpRequest request) async {
void saveNote(HttpRequest request, String myNote) {
try {
new File('notes.txt')
.writeAsStringSync(myNote, mode: FileMode.APPEND);
.writeAsStringSync(myNote, mode: FileMode.append);
} catch (e) {
print('Couldn\'t open notes.txt: $e');
request.response
Expand Down
2 changes: 1 addition & 1 deletion examples/httpserver/bin/number_guesser.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ Future<bool> guess() {
Future<bool> checkGuess(int guess) async {
bool isGoodGuess = false;
HttpClientRequest request =
await client.get(InternetAddress.LOOPBACK_IP_V4.host, 4041, '/?q=$guess');
await client.get(InternetAddress.loopbackIPv4.host, 4041, '/?q=$guess');
print('Guess is $guess.');
HttpClientResponse response = await request.close();
if (response.statusCode == HttpStatus.OK) {
Expand Down
2 changes: 1 addition & 1 deletion examples/httpserver/bin/number_thinker.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Future main() async {
print("I'm thinking of a number: $myNumber");

HttpServer server = await HttpServer.bind(
InternetAddress.LOOPBACK_IP_V4,
InternetAddress.loopbackIPv4,
4041,
);
await for (var request in server) {
Expand Down
2 changes: 1 addition & 1 deletion examples/httpserver/bin/static_file_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Future main() async {
staticFiles.serveFile(new File(indexUri.toFilePath()), request); /*3*/
};

var server = await HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 4048);
var server = await HttpServer.bind(InternetAddress.loopbackIPv4, 4048);
print('Listening on port 4048');
await server.forEach(staticFiles.serveRequest); /*4*/
}
2 changes: 1 addition & 1 deletion examples/misc/test/library_tour/io_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ void miscDeclAnalyzedButNotTested() {
{
var logFile = new File('test_data/log.txt');
// #docregion append
var sink = logFile.openWrite(mode: FileMode.APPEND);
var sink = logFile.openWrite(mode: FileMode.append);
// #enddocregion append
sink.close();
}
Expand Down
2 changes: 1 addition & 1 deletion scripts/convert_book.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ convertFile(String fileName) {
writeFile(String fileName, String title, String body) {
var out = new File('${outputDir.path}/${fileName}');
out.writeAsStringSync(frontMatter(title));
out.writeAsStringSync(body, mode: FileMode.APPEND);
out.writeAsStringSync(body, mode: FileMode.append);
}

checkDir(Directory dir) {
Expand Down
2 changes: 1 addition & 1 deletion src/_data/pkg-vers.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"doc-path": "install",
"channel": "dev",
"prev-vers": "1.24.3",
"vers": "2.0.0-dev.53.0"
"vers": "2.0.0-dev.55.0"
}
}
8 changes: 4 additions & 4 deletions src/_tutorials/dart-vm/cmdline.md
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ File quotesFile = new File('quotes.txt');
String stronger = 'That which does not kill us makes us stronger. -Nietzsche';

try {
await quotesFile.writeAsString(stronger, mode: FileMode.APPEND);
await quotesFile.writeAsString(stronger, mode: FileMode.append);
print('Data written.');
} catch (e) {
print('Oops!');
Expand All @@ -475,8 +475,8 @@ try {
The `writeAsString()` method writes the data asynchronously.
It opens the file before writing and closes the file when done.
To append data to an existing file, you can use the optional
parameter `mode` and set its value to `FileMode.APPEND`.
Otherwise, the mode is `FileMode.WRITE` and the previous contents of the file,
parameter `mode` and set its value to `FileMode.append`.
Otherwise, the mode is `FileMode.write` and the previous contents of the file,
if any, are overwritten.

If you want to write more data, you can open the file for writing.
Expand All @@ -486,7 +486,7 @@ at which time, you must close the file.
The `close()` method is asynchronous and returns a Future.

{% prettify dart %}
IOSink quotes = new File('quotes.txt').openWrite(mode: FileMode.APPEND);
IOSink quotes = new File('quotes.txt').openWrite(mode: FileMode.append);

quotes.write('A woman is like a tea bag; ');
quotes.write('you never know how strong it is until it\'s in hot water.');
Expand Down
18 changes: 9 additions & 9 deletions src/_tutorials/dart-vm/httpserver.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ import 'dart:async';

Future main() async {
var server = await HttpServer.bind(
InternetAddress.LOOPBACK_IP_V4,
InternetAddress.loopbackIPv4,
4040,
);
print('Listening on localhost:${server.port}');
Expand Down Expand Up @@ -162,7 +162,7 @@ The first statement in `main()` uses `HttpServer.bind()` to create an
<?code-excerpt "httpserver/bin/hello_world_server.dart (bind)"?>
{% prettify dart %}
var server = await HttpServer.bind(
InternetAddress.LOOPBACK_IP_V4,
InternetAddress.loopbackIPv4,
4040,
);
{% endprettify %}
Expand Down Expand Up @@ -343,7 +343,7 @@ Future main() async {
print("I'm thinking of a number: $myNumber");

HttpServer server = await HttpServer.bind(
InternetAddress.LOOPBACK_IP_V4,
InternetAddress.loopbackIPv4,
4041,
);
await for (var request in server) {
Expand Down Expand Up @@ -568,7 +568,7 @@ import 'dart:async';
import 'dart:io';
import 'dart:convert';

String _host = InternetAddress.LOOPBACK_IP_V4.host;
String _host = InternetAddress.loopbackIPv4.host;
String path = 'file.txt';

Map jsonData = {
Expand Down Expand Up @@ -657,7 +657,7 @@ import 'dart:async';
import 'dart:io';
import 'dart:convert';

String _host = InternetAddress.LOOPBACK_IP_V4.host;
String _host = InternetAddress.loopbackIPv4.host;

Future main() async {
var server = await HttpServer.bind(_host, 4049);
Expand All @@ -673,7 +673,7 @@ Future main() async {
var [!data = jsonDecode(content) as Map!]; [!/*3*/!]
var fileName = [!req.uri.pathSegments.last;!] [!/*4*/!]
await new File(fileName)
.writeAsString(content, mode: FileMode.WRITE);
.writeAsString(content, mode: FileMode.write);
req.response
..statusCode = HttpStatus.OK
..write('Wrote data for ${data['name']}.');
Expand Down Expand Up @@ -786,7 +786,7 @@ Future main() async {
var server;

try {
server = await HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 4044);
server = await HttpServer.bind(InternetAddress.loopbackIPv4, 4044);
} catch (e) {
print("Couldn't bind to port 4044: $e");
exit(-1);
Expand Down Expand Up @@ -850,7 +850,7 @@ Future main() async {
VirtualDirectory staticFiles = new VirtualDirectory('.');

var serverRequests =
await HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 4046);
await HttpServer.bind(InternetAddress.loopbackIPv4, 4046);
await for (var request in serverRequests) {
[!staticFiles.serveFile(targetFile, request);!]
}
Expand Down Expand Up @@ -891,7 +891,7 @@ Future main() async {
staticFiles.serveFile(new File(indexUri.toFilePath()), request); [!/*3*/!]
};

var server = await HttpServer.bind(InternetAddress.LOOPBACK_IP_V4, 4048);
var server = await HttpServer.bind(InternetAddress.loopbackIPv4, 4048);
print('Listening on port 4048');
await server.forEach(staticFiles.serveRequest); [!/*4*/!]
}
Expand Down
6 changes: 3 additions & 3 deletions src/dart-vm/io-library-tour.md
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ Future main() async {

You can use an [IOSink][] to
write data to a file. Use the File `openWrite()` method to get an IOSink
that you can write to. The default mode, `FileMode.WRITE`, completely
that you can write to. The default mode, `FileMode.write`, completely
overwrites existing data in the file.

<?code-excerpt "misc/test/library_tour/io_test.dart (write-file)" replace="/\btest_data\///g"?>
Expand All @@ -148,11 +148,11 @@ await sink.close();
{% endprettify %}

To add to the end of the file, use the optional `mode` parameter to
specify `FileMode.APPEND`:
specify `FileMode.append`:

<?code-excerpt "misc/test/library_tour/io_test.dart (append)" replace="/_?test_\w*\/?//g"?>
{% prettify dart %}
var sink = logFile.openWrite(mode: FileMode.APPEND);
var sink = logFile.openWrite(mode: FileMode.append);
{% endprettify %}

To write binary data, use `add(List<int> data)`.
Expand Down

0 comments on commit b162ba5

Please sign in to comment.