diff --git a/dev/bots/analyze.dart b/dev/bots/analyze.dart index f4a703c146a..adcbc2f1d22 100644 --- a/dev/bots/analyze.dart +++ b/dev/bots/analyze.dart @@ -435,6 +435,22 @@ Future verifyNoBadImportsInFlutter(String workingDirectory) async { ); } } + + for (final String key in dependencyMap.keys) { + for (final String dependency in dependencyMap[key]) { + if (dependencyMap[dependency] != null) + continue; + // Sanity check before performing _deepSearch, to ensure there's no rogue + // dependencies. + final String validFilenames = dependencyMap.keys.map((String name) => name + '.dart').join(', '); + errors.add( + '$key imported package:flutter/$dependency.dart ' + 'which is not one of the valid exports { $validFilenames }.\n' + 'Consider changing $dependency.dart to one of them.' + ); + } + } + for (final String package in dependencyMap.keys) { final List loop = _deepSearch(dependencyMap, package); if (loop != null) { @@ -1180,6 +1196,9 @@ Set _findFlutterDependencies(String srcPath, List errors, { bool } List _deepSearch(Map> map, T start, [ Set seen ]) { + if (map[start] == null) + return null; // We catch these separately. + for (final T key in map[start]) { if (key == start) continue; // we catch these separately