Skip to content

Commit

Permalink
Replace implicit-casts with strict-casts (#3218)
Browse files Browse the repository at this point in the history
`stict-casts` is the replacement for `implicit-casts` with additional
checking around for-in loops.

Add some explicit casts to `Iterable` for for-in loops.
  • Loading branch information
natebosch committed Nov 30, 2021
1 parent a4b73fe commit c34945b
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
include: package:lints/recommended.yaml
analyzer:
strong-mode:
implicit-casts: false
language:
strict-casts: true
errors:
unused_import: error
unused_local_variable: error
Expand Down
2 changes: 1 addition & 1 deletion build_runner_core/lib/src/asset_graph/serialization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class _AssetGraphDeserializer {
// Read in all the nodes and their outputs.
//
// Note that this does not read in the inputs of generated nodes.
for (var serializedItem in _serializedGraph['nodes']) {
for (var serializedItem in _serializedGraph['nodes'] as Iterable) {
graph._add(_deserializeAssetNode(serializedItem as List));
}

Expand Down
2 changes: 1 addition & 1 deletion build_runner_core/lib/src/package_graph/package_graph.dart
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ Map<String, DependencyType> _parseDependencyTypes(String rootPackagePath) {
}
final dependencyTypes = <String, DependencyType>{};
final dependencies = loadYaml(pubspecLock.readAsStringSync()) as YamlMap;
for (final packageName in dependencies['packages'].keys) {
for (final packageName in dependencies['packages'].keys as Iterable) {
final source = dependencies['packages'][packageName]['source'];
dependencyTypes[packageName as String] =
_dependencyTypeFromSource(source as String);
Expand Down

0 comments on commit c34945b

Please sign in to comment.