title: RangeError (index): Invalid value: Not in inclusive range 0..1: 2 when favoriting an item
body: <p>I'm making a favorites list viewer for my application. Basically, on the listview there will be a trailing containing a heart icon which will then add the designated item to the favorite menu. Here is the code for said action</p>
  <pre><code>title: Text(displayJournal[index].journalTitle!),
                trailing: journal_list[index].status == false
                ? IconButton(
                    onPressed: () {
                      favoriteBloc.addItems(JournalModel(
                        id: journal_list[index].id,
                        journalTitle: journal_list[index].journalTitle,
                        journalReleaseYear: journal_list[index].journalReleaseYear,
                        author: journal_list[index].author,
                        topic: journal_list[index].topic,
                        fileLocation: journal_list[index].fileLocation,
                        status: journal_list[index].status,
                        ));
                        
                        setState(() {
                        journal_list[index].status = true;
                      });
                    }, 
                    icon: const Icon(Icons.favorite_border))  
                : IconButton(
                  onPressed: () {
                      favoriteBloc.removeItems(favoriteBloc.items[index]);
  
                        setState(() {
                        journal_list[index].status = false;
                      });
                  },
                  icon: const Icon(Icons.favorite),
                  color: Colors.red,
                  ),
  </code></pre>
  <p>Here is the code on the favorite menu, essentially is the same thing but it's just the delete function</p>
  <pre><code>title: Text(favoriteBloc.items[index].journalTitle!),
              trailing: IconButton(
                onPressed: () {
                  favoriteBloc.removeItems(favoriteBloc.items[index]);
  
                   setState(() {
                    journal_list[index].status = false;
                    });
                },
                icon: const Icon(Icons.delete)
              ),
  </code></pre>
  <p>Since I'm using provider, i also have a <code>favorites_provider.dart</code>. Below is the code</p>
  <pre><code>import 'package:flutter/material.dart';
  import 'package:aplikasi_jurnal_mobile/models/journals.dart';
  import 'package:flutter/cupertino.dart';
  
  class FavoriteBloc with ChangeNotifier {
    int _count = 0;
    List&lt;JournalModel&gt; items = [];
  
    bool get isEmpty =&gt; items.isEmpty;
  
    void addItems(JournalModel data) {
      items.add(data);
      notifyListeners();
    }
  
    void removeItems(JournalModel data) {
      items.remove(data);
      notifyListeners();
    }
  
    int get count {
      return _count;
    }
  
    List&lt;JournalModel&gt; get itemsList {
      return items;
    }
  }
  </code></pre>
  <p>Also, here is the model structure of the item</p>
  <pre><code>class JournalModel{
    String? id;
    String? journalTitle;
    int? journalReleaseYear;
    String? author;
    String? topic;
    String? fileLocation;
    bool status;
  
  JournalModel({
    this.id,
     this.journalTitle,
     this.journalReleaseYear,
     this.author,
     this.topic,
     this.fileLocation,
     this.status = false
    });
  }
  </code></pre>
  <p>So essentially, what's supposed to happen is that if i press the heart icon it will change the state of the item's <code>is_favorited</code> to true, make the item appear at the favorite menu and turn the icon color to red. And if i press it again it would set it to false, remove the item from the favorite menu and make the icon grey again.</p>
  <p>And it works, but there is a bit of a problem. If i favorite an item sequentially, it would work no problem and i can delete it and the state would reset. However, if i were to favorite a random item on the list, the favorite button would be stuck on the &quot;favorited&quot; state.</p>
  <p>The same thing would happen if i were to delete the item from the favorite menu. If i remove an item in the middle of the list, the bottom one would be stuck on the favorite state and i have to reset the whole thing if that happens.</p>
  <p>If i look at the console, it would throw the error stated in the topic title above.</p>
  <p><a href="https://i.stack.imgur.com/oTliZ.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oTliZ.png" alt="enter image description here" /></a></p>