title: The return type 'dynamic' isn't a 'bool', as required by the closure's context
body: <p>I am implementing search bar in my flutter app. But the line <code>_allUsers.where((user) =&gt; user[&quot;name&quot;].toLowerCase().contains(enteredKeyword.toLowerCase())).toList();</code> throws an error: <em>'The return type 'dynamic' isn't a 'bool', as required by the closure's context.'</em>
  There is code:</p>
  <pre><code>  final List&lt;Map&lt;String, dynamic&gt;&gt; _allUsers = [
      {&quot;id&quot;: 1, &quot;name&quot;: &quot;Andy&quot;, &quot;type&quot;: &quot;student&quot;},
      {&quot;id&quot;: 2, &quot;name&quot;: &quot;Aragon&quot;, &quot;type&quot;: &quot;student&quot;},
      {&quot;id&quot;: 3, &quot;name&quot;: &quot;Bob&quot;, &quot;type&quot;: &quot;student&quot;},
      {&quot;id&quot;: 4, &quot;name&quot;: &quot;Barbara&quot;, &quot;type&quot;: &quot;teacher&quot;},
      {&quot;id&quot;: 5, &quot;name&quot;: &quot;Candy&quot;, &quot;type&quot;: 'student'},
    ];
    void _runFilter(String enteredKeyword) {
      List&lt;Map&lt;String, dynamic&gt;&gt; results = [];
      if (enteredKeyword.isEmpty) {
        results = _allUsers;
      } else {
        results = _allUsers.where((user) =&gt; user[&quot;name&quot;].toLowerCase().contains(enteredKeyword.toLowerCase())).toList();
      }
    }
  </code></pre>
  <p>When I try run this code in dartpad.dev it works, but in Android Studio it doesn't.</p>