Skip to content

Commit 027cfa6

Browse files
committed
style: appease analyzer
1 parent 5daaa9d commit 027cfa6

File tree

1 file changed

+12
-10
lines changed

1 file changed

+12
-10
lines changed

lib/src/rules/leaf_preview_must_not_use_injectables_or_navigation_rule.dart

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -86,15 +86,17 @@ class _Visitor extends SimpleAstVisitor<void> {
8686
if (previewMethod == null) {
8787
return;
8888
}
89-
if (!_isLeafPreviewOverride(classElement, previewMethod!)) {
89+
if (!_isLeafPreviewOverride(classElement, previewMethod)) {
9090
return;
9191
}
9292

93-
final topLevelFunctions = _indexTopLevelFunctions(context.currentUnit?.unit);
93+
final topLevelFunctions = _indexTopLevelFunctions(
94+
context.currentUnit?.unit,
95+
);
9496
final callStack = <String>['preview'];
9597
final seen = <String>{};
9698
final result = _findForbiddenUse(
97-
previewMethod!.body,
99+
previewMethod.body,
98100
methods,
99101
topLevelFunctions,
100102
callStack,
@@ -107,12 +109,9 @@ class _Visitor extends SimpleAstVisitor<void> {
107109
final path = result.path.join(' -> ');
108110
context.debug(
109111
'leaf_preview_must_not_use_injectables_or_navigation: report '
110-
'${classElement.displayName} at ${previewMethod!.offset}:${previewMethod.length}',
111-
);
112-
rule.reportAtNode(
113-
previewMethod!,
114-
arguments: ['$path -> ${result.sink}'],
112+
'${classElement.displayName} at ${previewMethod.offset}:${previewMethod.length}',
115113
);
114+
rule.reportAtNode(previewMethod, arguments: ['$path -> ${result.sink}']);
116115
}
117116
}
118117

@@ -250,7 +249,9 @@ class _CallRef {
250249
const _CallRef(this.kind, this.name);
251250
}
252251

253-
Map<String, FunctionDeclaration> _indexTopLevelFunctions(CompilationUnit? unit) {
252+
Map<String, FunctionDeclaration> _indexTopLevelFunctions(
253+
CompilationUnit? unit,
254+
) {
254255
if (unit == null) {
255256
return const {};
256257
}
@@ -324,7 +325,8 @@ bool _isDiAccessor(MethodInvocation node) {
324325
}
325326

326327
bool _isInjectableType(DartType? type) {
327-
return _isTypeNamed(type, 'Injectable') || _isSubtypeNamed(type, 'Injectable');
328+
return _isTypeNamed(type, 'Injectable') ||
329+
_isSubtypeNamed(type, 'Injectable');
328330
}
329331

330332
bool _isRoutingType(DartType? type) {

0 commit comments

Comments
 (0)