Skip to content
This repository has been archived by the owner on Jan 19, 2022. It is now read-only.

Commit

Permalink
dartfmt --fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo committed Jul 11, 2019
1 parent fb132a6 commit 7c6ccb8
Show file tree
Hide file tree
Showing 15 changed files with 38 additions and 32 deletions.
6 changes: 3 additions & 3 deletions anagram/web/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import 'dart:math';
String scrabbleLetters =
'aaaaaaaaabbccddddeeeeeeeeeeeeffggghhiiiiiiiiijkllllmmnnnnnnooooooooppqrrrrrrssssttttttuuuuvvwwxyyz**';

List<ButtonElement> buttons = new List();
List<ButtonElement> buttons = List();
Element letterpile;
Element result;
ButtonElement clearButton;
Expand Down Expand Up @@ -80,15 +80,15 @@ void newletters(Event e) {
}

void generateNewLetters() {
final indexGenerator = new Random();
final indexGenerator = Random();
wordvalue = 0;
value.text = '';
buttons.clear();
for (var i = 0; i < 7; i++) {
final letterIndex = indexGenerator.nextInt(scrabbleLetters.length);
// Should remove the letter from scrabbleLetters to keep the
// ratio correct.
buttons.add(new ButtonElement());
buttons.add(ButtonElement());
buttons[i].classes.add("letter");
buttons[i].onClick.listen(moveLetter);
buttons[i].text = scrabbleLetters[letterIndex];
Expand Down
3 changes: 1 addition & 2 deletions cmdline/bin/dcat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,7 @@ ArgResults argResults;
void main(List<String> arguments) {
exitCode = 0; //presume success
final parser = new ArgParser()
..addFlag(lineNumber, negatable: false, abbr: 'n');
final parser = ArgParser()..addFlag(lineNumber, negatable: false, abbr: 'n');

argResults = parser.parse(arguments);
final paths = argResults.rest;
Expand Down
10 changes: 5 additions & 5 deletions cmdline/bin/dgrep.dart
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ const followLinks = 'follow-links';
ArgResults argResults;

void printMatch(File file, List lines, int i) {
final sb = new StringBuffer();
final sb = StringBuffer();
if (argResults[recursive]) sb.write('${file.path}:');
if (argResults[lineNumber]) sb.write('${i + 1}:');
sb.write(lines[i]);
Expand All @@ -40,7 +40,7 @@ Future searchFile(File file, List<String> searchTerms) async {
}

Future main(List<String> arguments) async {
final parser = new ArgParser()
final parser = ArgParser()
..addFlag(recursive, negatable: false, abbr: 'r')
..addFlag(lineNumber, negatable: false, abbr: 'n')
..addFlag(followLinks, negatable: false, abbr: 'S');
Expand All @@ -56,17 +56,17 @@ Future main(List<String> arguments) async {
final searchTerms = argResults.rest.sublist(0, argResults.rest.length - 1);

if (await FileSystemEntity.isDirectory(searchPath)) {
final startingDir = new Directory(searchPath);
final startingDir = Directory(searchPath);
await for (var entity in startingDir.list(
recursive: argResults[recursive],
followLinks: argResults[followLinks])) {
if (entity is File) {
await searchFile(entity, searchTerms);
} else {
await searchFile(new File(searchPath), searchTerms);
await searchFile(File(searchPath), searchTerms);
}
}
} else {
await searchFile(new File(searchPath), searchTerms);
await searchFile(File(searchPath), searchTerms);
}
}
4 changes: 3 additions & 1 deletion futures/futures-api-catch-error/web/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ final pre = PreElement();

void printDailyNewsDigest() {
final future = gatherNewsReports();
future.then((content) => pre.appendText(content)).catchError((e) => handleError(e));
future
.then((content) => pre.appendText(content))
.catchError((e) => handleError(e));
}

void main() {
Expand Down
2 changes: 1 addition & 1 deletion httpserver/bin/basic_writer_client.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
// to the server and prints the response.

import 'dart:async';
import 'dart:io';
import 'dart:convert';
import 'dart:io';

String _host = InternetAddress.loopbackIPv4.host;
String path = 'file.txt';
Expand Down
2 changes: 1 addition & 1 deletion httpserver/bin/basic_writer_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
// the file specified in the URI.

import 'dart:async';
import 'dart:io';
import 'dart:convert';
import 'dart:io';

String _host = InternetAddress.loopbackIPv4.host;

Expand Down
1 change: 1 addition & 0 deletions httpserver/bin/mini_file_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

import 'dart:async';
import 'dart:io';

import 'package:path/path.dart' as p;

var targetFile =
Expand Down
3 changes: 2 additions & 1 deletion httpserver/bin/note_server.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
// Use note_taker.html to run the client.

import 'dart:async';
import 'dart:io';
import 'dart:convert' show utf8, json;
import 'dart:io';

import 'package:path/path.dart' as p;

int count = 0;
Expand Down
14 changes: 8 additions & 6 deletions httpserver/test/httpserver_test.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import 'dart:async';
import 'dart:convert';
import 'dart:io';

import 'package:test/test.dart';

import '../bin/basic_file_server.dart' as basic_file_server;
import '../bin/basic_writer_client.dart' as basic_writer_client;
import '../bin/basic_writer_server.dart' as basic_writer_server;
Expand Down Expand Up @@ -101,9 +103,9 @@ void main() {

expect(
() async => Future.any([
server,
_test(),
]),
server,
_test(),
]),
prints(''),
);
});
Expand All @@ -121,9 +123,9 @@ void main() {

expect(
() async => Future.any([
server,
_test(),
]),
server,
_test(),
]),
prints('Wrote data for Han Solo.\n'),
);
});
Expand Down
8 changes: 4 additions & 4 deletions portmanteaux/web/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void main() {

void makeRequest(Event e) {
var path = 'https://dart.dev/f/portmanteaux.json';
var httpRequest = new HttpRequest();
var httpRequest = HttpRequest();
httpRequest
..open('GET', path)
..onLoadEnd.listen((e) => requestComplete(httpRequest))
Expand All @@ -28,10 +28,10 @@ void requestComplete(HttpRequest request) {
final portmanteaux =
(json.decode(request.responseText) as List<dynamic>).cast<String>();
for (var i = 0; i < portmanteaux.length; i++) {
wordList.children.add(new LIElement()..text = portmanteaux[i]);
wordList.children.add(LIElement()..text = portmanteaux[i]);
}
} else {
wordList.children.add(
new LIElement()..text = 'Request failed, status=${request.status}');
wordList.children
.add(LIElement()..text = 'Request failed, status=${request.status}');
}
}
7 changes: 4 additions & 3 deletions portmanteaux_simple/web/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,13 @@ Future makeRequest(Event e) async {
}

void processString(String jsonString) {
final portmanteaux = (json.decode(jsonString) as List<dynamic>).cast<String>();
final portmanteaux =
(json.decode(jsonString) as List<dynamic>).cast<String>();
for (var i = 0; i < portmanteaux.length; i++) {
wordList.children.add(new LIElement()..text = portmanteaux[i]);
wordList.children.add(LIElement()..text = portmanteaux[i]);
}
}

void handleError(Object error) {
wordList.children.add(new LIElement()..text = 'Request failed.');
wordList.children.add(LIElement()..text = 'Request failed.');
}
2 changes: 1 addition & 1 deletion streams/last_positive/bin/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Future<int> lastPositive(Stream<int> stream) async {

Future main() async {
var data = [1, -2, 3, -4, 5, -6, 7, -8, 9, -10];
var stream = new Stream.fromIterable(data);
var stream = Stream.fromIterable(data);
var lastPos = await lastPositive(stream);
print(lastPos); // 9
}
4 changes: 2 additions & 2 deletions streams/read_file/bin/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,17 @@
// All rights reserved. Use of this source code is governed
// by a BSD-style license that can be found in the LICENSE file.

import 'dart:io';
import 'dart:async';
import 'dart:convert';
import 'dart:io';

Future main(List<String> args) async {
if (args.isEmpty) {
print("Requires a filepath as the first argument");
return;
}

var file = new File(args[0]);
var file = File(args[0]);
var lines =
utf8.decoder.bind(file.openRead()).transform(const LineSplitter());
await for (var line in lines) {
Expand Down
2 changes: 1 addition & 1 deletion todo/web/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ void main() {
}

void addToDoItem(Event e) {
var newToDo = new LIElement();
var newToDo = LIElement();
newToDo.text = toDoInput.value;
toDoInput.value = '';
toDoList.children.add(newToDo);
Expand Down
2 changes: 1 addition & 1 deletion todo_with_delete/web/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void main() {
}

void addToDoItem(Event e) {
var newToDo = new LIElement();
var newToDo = LIElement();
newToDo.text = toDoInput.value;
newToDo.onClick.listen((e) => newToDo.remove());
toDoInput.value = '';
Expand Down

0 comments on commit 7c6ccb8

Please sign in to comment.