title: How can i print random task/item from the list in flutter? - Instead showing content of list it just prints "instance of "task"?
body: <p>I was wondering how can I print/display text of random item from the list?
  Here is the code of the list i have</p>
  <pre><code>class TaskData extends ChangeNotifier {
    List&lt;Task&gt; _tasks = [
      Task(name: &quot;Task one&quot;),
      Task(name: &quot;Task two&quot;),
      Task(name: &quot;Task three&quot;),
    ];
  
    UnmodifiableListView&lt;Task&gt; get tasks {
      return UnmodifiableListView(_tasks);
    }
  
    int get taskCount {
      return _tasks.length;
    }
  
    void randomvo() {
      var randomItem = (_tasks.toList()..shuffle()).first;
      print(randomItem);
    }
  </code></pre>
  <p>Here I have a different file with buttons and I managed to get some code to just test it out, but instead of printing random names from the list(Like task one or task two), it just prints &quot;Instance of &quot;Task&quot;&quot;</p>
  <pre><code>return Scaffold(
    floatingActionButton: Row(
      mainAxisAlignment: MainAxisAlignment.spaceEvenly,
      children: &lt;Widget&gt;[
        FloatingActionButton.extended(
            label: const Text(&quot;Randomize&quot;),
            backgroundColor: Colors.red,
            onPressed: () {
              Provider.of&lt;TaskData&gt;(context, listen: false).randomvo();
            }),
  </code></pre>
  <p>Would really appreciate it if someone could help me with this one
  Thank you!</p>