Skip to content
This repository was archived by the owner on May 11, 2021. It is now read-only.

Commit 4614e93

Browse files
committed
fix NoSuchMethodError in filter
I got errors when using `filter` for objects that is nullable. I seem to be no substantial problem. However, I want to suppress unwanted errors. ``` The null object does not have a method 'toList'. NoSuchMethodError: method not found: 'toList' Receiver: null Arguments: [growable: false] STACKTRACE: #0 Object.noSuchMethod (dart:core-patch/object_patch.dart:45) #1 Filter.call (package:angular/formatter/filter.dart:193:26) ... ```
1 parent f9406a4 commit 4614e93

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

lib/formatter/filter.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,9 @@ class Filter implements Function {
189189
}
190190

191191
List call(List items, var expression, [var comparator]) {
192+
if (items == null) {
193+
return const [];
194+
}
192195
if (expression == null) {
193196
return items.toList(growable: false); // Missing expression → passthrough.
194197
} else if (expression is! Map && expression is! Function &&

0 commit comments

Comments
 (0)