Skip to content

Commit dbec178

Browse files
Fixup generate_crossword (#2254)
1 parent f7a5728 commit dbec178

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+269
-197
lines changed

generate_crossword/codelab_rebuild.yaml

Lines changed: 35 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ steps:
1919
analyzer:
2020
language:
2121
strict-inference: false
22+
exclude:
23+
- lib/*.g.dart
2224

2325
linter:
2426
rules:
@@ -199,13 +201,14 @@ steps:
199201

200202
import 'package:built_collection/built_collection.dart';
201203
import 'package:flutter/services.dart';
204+
import 'package:riverpod/riverpod.dart';
202205
import 'package:riverpod_annotation/riverpod_annotation.dart';
203206

204207
part 'providers.g.dart';
205208

206209
/// A provider for the wordlist to use when generating the crossword.
207210
@riverpod
208-
Future<BuiltSet<String>> wordList(WordListRef ref) async {
211+
Future<BuiltSet<String>> wordList(Ref ref) async {
209212
// This codebase requires that all words consist of lowercase characters
210213
// in the range 'a'-'z'. Words containing uppercase letters will be
211214
// lowercased, and words containing runes outside this range will
@@ -49373,24 +49376,25 @@ steps:
4937349376
patch: |
4937449377
--- b/generate_crossword/step_04/lib/providers.dart
4937549378
+++ a/generate_crossword/step_04/lib/providers.dart
49376-
@@ -3,11 +3,16 @@
49379+
@@ -3,12 +3,17 @@
4937749380
// found in the LICENSE file.
49378-
49381+
4937949382
import 'dart:convert';
4938049383
+import 'dart:math';
49381-
49384+
4938249385
import 'package:built_collection/built_collection.dart';
4938349386
+import 'package:flutter/foundation.dart';
4938449387
import 'package:flutter/services.dart';
49388+
import 'package:riverpod/riverpod.dart';
4938549389
import 'package:riverpod_annotation/riverpod_annotation.dart';
49386-
49390+
4938749391
+import 'model.dart' as model;
4938849392
+import 'utils.dart';
4938949393
+
4939049394
part 'providers.g.dart';
49391-
49395+
4939249396
/// A provider for the wordlist to use when generating the crossword.
49393-
@@ -25,3 +30,72 @@ Future<BuiltSet<String>> wordList(WordListRef ref) async {
49397+
@@ -26,3 +31,72 @@ Future<BuiltSet<String>> wordList(Ref ref) async {
4939449398
..where((word) => word.length > 2)
4939549399
..where((word) => re.hasMatch(word)));
4939649400
}
@@ -49430,7 +49434,7 @@ steps:
4943049434
+final _random = Random();
4943149435
+
4943249436
+@riverpod
49433-
+Stream<model.Crossword> crossword(CrosswordRef ref) async* {
49437+
+Stream<model.Crossword> crossword(Ref ref) async* {
4943449438
+ final size = ref.watch(sizeProvider);
4943549439
+ final wordListAsync = ref.watch(wordListProvider);
4943649440
+
@@ -50174,7 +50178,7 @@ steps:
5017450178
patch: |
5017550179
--- b/generate_crossword/step_05_a/lib/providers.dart
5017650180
+++ a/generate_crossword/step_05_a/lib/providers.dart
50177-
@@ -82,10 +82,16 @@ Stream<model.Crossword> crossword(CrosswordRef ref) async* {
50181+
@@ -83,10 +83,16 @@ Stream<model.Crossword> crossword(Ref ref) async* {
5017850182
final location = model.Location.at(
5017950183
_random.nextInt(size.width), _random.nextInt(size.height));
5018050184

@@ -50232,7 +50236,7 @@ steps:
5023250236
patch: |
5023350237
--- b/generate_crossword/step_05_b/lib/providers.dart
5023450238
+++ a/generate_crossword/step_05_b/lib/providers.dart
50235-
@@ -81,16 +81,20 @@ Stream<model.Crossword> crossword(CrosswordRef ref) async* {
50239+
@@ -82,16 +82,20 @@ Stream<model.Crossword> crossword(Ref ref) async* {
5023650240
_random.nextBool() ? model.Direction.across : model.Direction.down;
5023750241
final location = model.Location.at(
5023850242
_random.nextInt(size.width), _random.nextInt(size.height));
@@ -50343,15 +50347,16 @@ steps:
5034350347
patch: |
5034450348
--- b/generate_crossword/step_05_c/lib/providers.dart
5034550349
+++ a/generate_crossword/step_05_c/lib/providers.dart
50346-
@@ -3,15 +3,14 @@
50350+
@@ -3,7 +3,6 @@
5034750351
// found in the LICENSE file.
5034850352

5034950353
import 'dart:convert';
5035050354
-import 'dart:math';
5035150355

5035250356
import 'package:built_collection/built_collection.dart';
5035350357
import 'package:flutter/foundation.dart';
50354-
import 'package:flutter/services.dart';
50358+
@@ -11,8 +10,8 @@ import 'package:flutter/services.dart';
50359+
import 'package:riverpod/riverpod.dart';
5035550360
import 'package:riverpod_annotation/riverpod_annotation.dart';
5035650361

5035750362
+import 'isolates.dart';
@@ -50360,14 +50365,14 @@ steps:
5036050365

5036150366
part 'providers.g.dart';
5036250367

50363-
@@ -63,49 +62,25 @@ class Size extends _$Size {
50368+
@@ -64,49 +63,25 @@ class Size extends _$Size {
5036450369
}
5036550370
}
5036650371

5036750372
-final _random = Random();
5036850373
-
5036950374
@riverpod
50370-
Stream<model.Crossword> crossword(CrosswordRef ref) async* {
50375+
Stream<model.Crossword> crossword(Ref ref) async* {
5037150376
final size = ref.watch(sizeProvider);
5037250377
final wordListAsync = ref.watch(wordListProvider);
5037350378

@@ -50950,12 +50955,12 @@ steps:
5095050955

5095150956
import 'package:built_collection/built_collection.dart';
5095250957
import 'package:flutter/foundation.dart';
50953-
@@ -63,12 +64,19 @@ class Size extends _$Size {
50958+
@@ -64,12 +65,19 @@ class Size extends _$Size {
5095450959
}
5095550960

5095650961
@riverpod
50957-
-Stream<model.Crossword> crossword(CrosswordRef ref) async* {
50958-
+Stream<model.WorkQueue> workQueue(WorkQueueRef ref) async* {
50962+
-Stream<model.Crossword> crossword(Ref ref) async* {
50963+
+Stream<model.WorkQueue> workQueue(Ref ref) async* {
5095950964
final size = ref.watch(sizeProvider);
5096050965
final wordListAsync = ref.watch(wordListProvider);
5096150966
-
@@ -50972,7 +50977,7 @@ steps:
5097250977

5097350978
yield* wordListAsync.when(
5097450979
data: (wordList) => exploreCrosswordSolutions(
50975-
@@ -77,10 +85,100 @@ Stream<model.Crossword> crossword(CrosswordRef ref) async* {
50980+
@@ -78,10 +86,100 @@ Stream<model.Crossword> crossword(Ref ref) async* {
5097650981
),
5097750982
error: (error, stackTrace) async* {
5097850983
debugPrint('Error loading word list: $error');
@@ -51022,7 +51027,7 @@ steps:
5102251027
+const _estimatedTotalCoverage = 0.54;
5102351028
+
5102451029
+@riverpod
51025-
+Duration expectedRemainingTime(ExpectedRemainingTimeRef ref) {
51030+
+Duration expectedRemainingTime(Ref ref) {
5102651031
+ final startTime = ref.watch(startTimeProvider);
5102751032
+ final endTime = ref.watch(endTimeProvider);
5102851033
+ final workQueueAsync = ref.watch(workQueueProvider);
@@ -51544,23 +51549,23 @@ steps:
5154451549
patch: |
5154551550
--- b/generate_crossword/step_08/lib/providers.dart
5154651551
+++ a/generate_crossword/step_08/lib/providers.dart
51547-
@@ -65,6 +65,7 @@ class Size extends _$Size {
51552+
@@ -66,6 +66,7 @@ class Size extends _$Size {
5154851553

5154951554
@riverpod
51550-
Stream<model.WorkQueue> workQueue(WorkQueueRef ref) async* {
51555+
Stream<model.WorkQueue> workQueue(Ref ref) async* {
5155151556
+ final workers = ref.watch(workerCountProvider);
5155251557
final size = ref.watch(sizeProvider);
5155351558
final wordListAsync = ref.watch(wordListProvider);
5155451559
final emptyCrossword =
51555-
@@ -82,6 +83,7 @@ Stream<model.WorkQueue> workQueue(WorkQueueRef ref) async* {
51560+
@@ -83,6 +84,7 @@ Stream<model.WorkQueue> workQueue(Ref ref) async* {
5155651561
data: (wordList) => exploreCrosswordSolutions(
5155751562
crossword: emptyCrossword,
5155851563
wordList: wordList,
5155951564
+ maxWorkerCount: workers.count,
5156051565
),
5156151566
error: (error, stackTrace) async* {
5156251567
debugPrint('Error loading word list: $error');
51563-
@@ -182,3 +184,33 @@ class DisplayInfo extends _$DisplayInfo {
51568+
@@ -183,3 +185,33 @@ class DisplayInfo extends _$DisplayInfo {
5156451569
loading: () => model.DisplayInfo.empty,
5156551570
);
5156651571
}
@@ -52201,24 +52206,24 @@ steps:
5220152206

5220252207
import 'package:built_collection/built_collection.dart';
5220352208
import 'package:flutter/foundation.dart';
52204-
@@ -15,6 +14,8 @@ import 'model.dart' as model;
52209+
@@ -16,6 +15,8 @@ import 'model.dart' as model;
5220552210

5220652211
part 'providers.g.dart';
5220752212

5220852213
+const backgroundWorkerCount = 4;
5220952214
+
5221052215
/// A provider for the wordlist to use when generating the crossword.
5221152216
@riverpod
52212-
Future<BuiltSet<String>> wordList(WordListRef ref) async {
52213-
@@ -65,7 +66,6 @@ class Size extends _$Size {
52217+
Future<BuiltSet<String>> wordList(Ref ref) async {
52218+
@@ -66,7 +67,6 @@ class Size extends _$Size {
5221452219

5221552220
@riverpod
52216-
Stream<model.WorkQueue> workQueue(WorkQueueRef ref) async* {
52221+
Stream<model.WorkQueue> workQueue(Ref ref) async* {
5221752222
- final workers = ref.watch(workerCountProvider);
5221852223
final size = ref.watch(sizeProvider);
5221952224
final wordListAsync = ref.watch(wordListProvider);
5222052225
final emptyCrossword =
52221-
@@ -76,14 +76,11 @@ Stream<model.WorkQueue> workQueue(WorkQueueRef ref) async* {
52226+
@@ -77,14 +77,11 @@ Stream<model.WorkQueue> workQueue(Ref ref) async* {
5222252227
startLocation: model.Location.at(0, 0),
5222352228
);
5222452229

@@ -52234,7 +52239,7 @@ steps:
5223452239
),
5223552240
error: (error, stackTrace) async* {
5223652241
debugPrint('Error loading word list: $error');
52237-
@@ -93,124 +90,78 @@ Stream<model.WorkQueue> workQueue(WorkQueueRef ref) async* {
52242+
@@ -94,124 +91,78 @@ Stream<model.WorkQueue> workQueue(Ref ref) async* {
5223852243
yield emptyWorkQueue;
5223952244
},
5224052245
);
@@ -52276,7 +52281,7 @@ steps:
5227652281
-const _estimatedTotalCoverage = 0.54;
5227752282
-
5227852283
@riverpod
52279-
-Duration expectedRemainingTime(ExpectedRemainingTimeRef ref) {
52284+
-Duration expectedRemainingTime(Ref ref) {
5228052285
- final startTime = ref.watch(startTimeProvider);
5228152286
- final endTime = ref.watch(endTimeProvider);
5228252287
- final workQueueAsync = ref.watch(workQueueProvider);

generate_crossword/step_02/analysis_options.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ include: ../../analysis_options.yaml
33
analyzer:
44
language:
55
strict-inference: false
6+
exclude:
7+
- lib/*.g.dart
68

79
linter:
810
rules:

generate_crossword/step_02/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip

generate_crossword/step_02/android/settings.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ pluginManagement {
1818

1919
plugins {
2020
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21-
id "com.android.application" version "7.3.0" apply false
22-
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
21+
id "com.android.application" version "8.1.0" apply false
22+
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
2323
}
2424

2525
include ":app"

generate_crossword/step_02/pubspec.yaml

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,29 @@ publish_to: 'none'
44
version: 0.1.0
55

66
environment:
7-
sdk: ^3.5.1
7+
sdk: ^3.5.3
88

99
dependencies:
1010
flutter:
1111
sdk: flutter
1212
built_collection: ^5.1.1
1313
built_value: ^8.9.2
1414
characters: ^1.3.0
15-
flutter_riverpod: ^2.5.1
15+
flutter_riverpod: ^2.6.1
1616
intl: ^0.19.0
17-
riverpod: ^2.5.1
18-
riverpod_annotation: ^2.3.5
19-
two_dimensional_scrollables: ^0.3.1
17+
riverpod: ^2.6.1
18+
riverpod_annotation: ^2.6.1
19+
two_dimensional_scrollables: ^0.3.3
2020

2121
dev_dependencies:
2222
flutter_test:
2323
sdk: flutter
2424
flutter_lints: ^4.0.0
25-
build_runner: ^2.4.12
25+
build_runner: ^2.4.13
2626
built_value_generator: ^8.9.2
27-
custom_lint: ^0.6.5
28-
riverpod_generator: ^2.4.3
29-
riverpod_lint: ^2.3.13
27+
custom_lint: ^0.6.8
28+
riverpod_generator: ^2.6.1
29+
riverpod_lint: ^2.6.1
3030

3131
flutter:
3232
uses-material-design: true

generate_crossword/step_03/analysis_options.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@ include: ../../analysis_options.yaml
33
analyzer:
44
language:
55
strict-inference: false
6+
exclude:
7+
- lib/*.g.dart
68

79
linter:
810
rules:

generate_crossword/step_03/android/gradle/wrapper/gradle-wrapper.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,4 @@ distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
33
zipStoreBase=GRADLE_USER_HOME
44
zipStorePath=wrapper/dists
5-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
5+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-all.zip

generate_crossword/step_03/android/settings.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ pluginManagement {
1818

1919
plugins {
2020
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
21-
id "com.android.application" version "7.3.0" apply false
22-
id "org.jetbrains.kotlin.android" version "1.7.10" apply false
21+
id "com.android.application" version "8.1.0" apply false
22+
id "org.jetbrains.kotlin.android" version "1.8.22" apply false
2323
}
2424

2525
include ":app"

generate_crossword/step_03/lib/providers.dart

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ import 'dart:convert';
66

77
import 'package:built_collection/built_collection.dart';
88
import 'package:flutter/services.dart';
9+
import 'package:riverpod/riverpod.dart';
910
import 'package:riverpod_annotation/riverpod_annotation.dart';
1011

1112
part 'providers.g.dart';
1213

1314
/// A provider for the wordlist to use when generating the crossword.
1415
@riverpod
15-
Future<BuiltSet<String>> wordList(WordListRef ref) async {
16+
Future<BuiltSet<String>> wordList(Ref ref) async {
1617
// This codebase requires that all words consist of lowercase characters
1718
// in the range 'a'-'z'. Words containing uppercase letters will be
1819
// lowercased, and words containing runes outside this range will

generate_crossword/step_03/lib/providers.g.dart

Lines changed: 4 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)