Skip to content

Commit 1382b0f

Browse files
committed
fix null check build error
1 parent 809be17 commit 1382b0f

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

packages/runner/lib/flutter_gen_runner.dart

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -34,21 +34,20 @@ class FlutterGenBuilder extends Builder {
3434

3535
@override
3636
Future<void> build(BuildStep buildStep) async {
37-
if (_config == null) {
38-
return;
39-
}
40-
final state = await _createState(_config, buildStep);
41-
if (state.shouldSkipGenerate(_currentState)) {
42-
return;
37+
if (_config case final config?) {
38+
final state = await _createState(config, buildStep);
39+
if (state.shouldSkipGenerate(_currentState)) {
40+
return;
41+
}
42+
_currentState = state;
43+
44+
await generator.build(
45+
config: config,
46+
writer: (contents, path) {
47+
buildStep.writeAsString(_output(buildStep, path), contents);
48+
},
49+
);
4350
}
44-
_currentState = state;
45-
46-
await generator.build(
47-
config: _config,
48-
writer: (contents, path) {
49-
buildStep.writeAsString(_output(buildStep, path), contents);
50-
},
51-
);
5251
}
5352

5453
@override

0 commit comments

Comments
 (0)