title: .contains doesnt work like i thought it would Flutter/Dart
body: <p>I am very new to Flutter and I run into a Problem. I want to check if the <strong>List: items</strong>, contains the word
  <strong>Hey</strong> and I know it does. So I wrote: <code>if(items.contains('Hey'))</code> to check. But it seems to skip the <code>if</code> part and only returns the else part. I wrote this easy Code to show you what I mean. I would really appreciate
  a quick answer, because of I really need to solve this problem.</p>
  <pre><code>import 'package:flutter/material.dart';
  
  void main() =&gt; runApp(MaterialApp(home: Contain()));
  
  class Liste {
    String Wort1;
    String Wort2;
  
    Liste({this.Wort1, this.Wort2});
  }
  
  class Contain extends StatefulWidget {
    @override
    _ContainState createState() =&gt; _ContainState();
  }
  
  class _ContainState extends State&lt;Contain&gt; {
    List&lt;Liste&gt; items = List&lt;Liste&gt;();
  
    @override
    void initState() {
      items = [
        Liste(Wort1: 'Hey', Wort2: 'Ho'),
        Liste(Wort1: 'HA', Wort2: 'HE'),
      ];
      super.initState();
    }
  
    function() {
      if (items.contains('Hey')) {
        return Center(
          child: Text('Works'),
        );
      } else {
        return Center(
          child: Text('Not Working'),
        );
      }
    }
  
    @override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(
          title: Text('Title'),
        ),
        body: function(),
      );
    }
  }
  </code></pre>