Skip to content

Commit 7054440

Browse files
committed
Format dart files
1 parent 1de5708 commit 7054440

10 files changed

Lines changed: 1238 additions & 783 deletions

samples/crossword/lib/isolates.dart

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -29,24 +29,34 @@ Stream<WorkQueue> exploreCrosswordSolutions({
2929
}
3030
}
3131

32-
debugPrint('Generated ${workQueue.crossword.width} x '
33-
'${workQueue.crossword.height} crossword in '
34-
'${DateTime.now().difference(start).formatted} '
35-
'with $maxWorkerCount workers.');
32+
debugPrint(
33+
'Generated ${workQueue.crossword.width} x '
34+
'${workQueue.crossword.height} crossword in '
35+
'${DateTime.now().difference(start).formatted} '
36+
'with $maxWorkerCount workers.',
37+
);
3638
}
3739

3840
Future<WorkQueue> _generate((WorkQueue, int) workMessage) async {
3941
var (workQueue, maxWorkerCount) = workMessage;
4042
final candidateGeneratorFutures = <Future<(Location, Direction, String?)>>[];
41-
final locations = workQueue.locationsToTry.keys.toBuiltList().rebuild((b) => b
42-
..shuffle()
43-
..take(maxWorkerCount));
43+
final locations = workQueue.locationsToTry.keys.toBuiltList().rebuild(
44+
(b) => b
45+
..shuffle()
46+
..take(maxWorkerCount),
47+
);
4448

4549
for (final location in locations) {
4650
final direction = workQueue.locationsToTry[location]!;
4751

48-
candidateGeneratorFutures.add(compute(_generateCandidate,
49-
(workQueue.crossword, workQueue.candidateWords, location, direction)));
52+
candidateGeneratorFutures.add(
53+
compute(_generateCandidate, (
54+
workQueue.crossword,
55+
workQueue.candidateWords,
56+
location,
57+
direction,
58+
)),
59+
);
5060
}
5161

5262
try {
@@ -55,7 +65,10 @@ Future<WorkQueue> _generate((WorkQueue, int) workMessage) async {
5565
for (final (location, direction, word) in results) {
5666
if (word != null) {
5767
final candidate = crossword.addWord(
58-
location: location, word: word, direction: direction);
68+
location: location,
69+
word: word,
70+
direction: direction,
71+
);
5972
if (candidate != null) {
6073
crossword = candidate;
6174
}
@@ -73,7 +86,8 @@ Future<WorkQueue> _generate((WorkQueue, int) workMessage) async {
7386
}
7487

7588
(Location, Direction, String?) _generateCandidate(
76-
(Crossword, BuiltSet<String>, Location, Direction) searchDetailMessage) {
89+
(Crossword, BuiltSet<String>, Location, Direction) searchDetailMessage,
90+
) {
7791
final (crossword, candidateWords, location, direction) = searchDetailMessage;
7892

7993
final target = crossword.characters[location];
@@ -83,9 +97,11 @@ Future<WorkQueue> _generate((WorkQueue, int) workMessage) async {
8397

8498
// Filter down the candidate word list to those that contain the letter
8599
// at the current location
86-
final words = candidateWords.toBuiltList().rebuild((b) => b
87-
..where((b) => b.characters.contains(target.character))
88-
..shuffle());
100+
final words = candidateWords.toBuiltList().rebuild(
101+
(b) => b
102+
..where((b) => b.characters.contains(target.character))
103+
..shuffle(),
104+
);
89105
int tryCount = 0;
90106
final start = DateTime.now();
91107
for (final word in words) {

0 commit comments

Comments
 (0)