AngularDart Filter call method throws error when 'items' is null


When I load a component using ‘filter’, the ‘call’ method is being run before the ‘items’ parameter is being set. So I am getting repeating errors from line 200. Eventually, ‘items’ is sent and the ‘call’ method runs without error.

The null object does not have a method 'where'.

NoSuchMethodError: method not found: 'where'
Receiver: null
Arguments: [Closure: (dynamic) => dynamic]

#0      Object._noSuchMethod (dart:core-patch/object_patch.dart:42)
#1      Object.noSuchMethod (dart:core-patch/object_patch.dart:45)
#2 (package:angular/formatter/filter.dart:200:26) 

This is the first time I have implemented filter using AngularDart, and this is happening in both components I’ve tried. There’s nothing special in my template:

<tr ng-repeat="appSession in appSessions | orderBy: orderByList | filter: filterObject">

The appSessions list is either set by an attribute or if not provided, in attach method. In this case, it is being set by the attribute.

@NgOneWay("app-sessions") List<AppSessionModel> appSessions;
@NgOneWay("mobile-user-id") int mobileUserID;

void attach() {

    if (appSessions == null) {
        if (mobileUserID != null) {
            appSessionManager.getForUser(mobileUserID).then((sessions) {
                appSessions = sessions;
        } else if (!fromUserTable) {
            appSessionManager.getOpen().then((sessions) {
                appSessions = sessions;

Has anyone else experienced this? Is there a timing bug here?



After more debugging, I confirmed that my list was never null in the ‘attach’ method, and I confirmed that was running after the ‘attach’ method. It turns out that the problem related to the ‘orderBy’ in the template.

I had this:

<tr ng-repeat="appSession in appSessions | orderBy: orderByList | filter: filterObject">

If I switch ‘orderBy’ and ‘filter’, then no more error:

<tr ng-repeat="appSession in appSessions | filter: filterObject | orderBy: orderByList">

I debugged, but it is not returning ‘items’ as null, so the problem seems to be somewhere between OrderBy and Filter, but I don’t know enough about AngularDart to know what that might be.

Answered By – Sam B

Answer Checked By – Dawn Plyler (FlutterFixes Volunteer)

Leave a Reply

Your email address will not be published.