title: Flutter bloc: yielding state doesn't triggers widget rebuild
body: <p>In my reminder app, when I click the add reminder button, it actually adds the reminder to the database and then updates my reminders, but the list of reminders is not rebuild. For some reason, a similar scenario works great when I delete my reminders.</p>
  <p>part of my bloc:</p>
  <pre><code>
    void _loadReminders() async {
      final reminders = await _repository.getAllReminders();
      reminders.sort((a, b) =&gt; a.dateTime.isAfter(b.dateTime) ? 1 : -1);
      if (reminders.isNotEmpty) {
        add(RemindersLoaded(reminders: reminders));
      }
    }
  
    @override
    Stream&lt;MainState&gt; mapEventToState(MainEvent event) async* {
      if (event is ItemSelected) {
        yield state.copyWith(isSelectedModeActive: true);
      } else if (event is SelectModeDisabled) {
        yield state.copyWith(isSelectedModeActive: false);
      } else if (event is RemindersLoaded) {
        yield state.copyWith(reminders: event.reminders);
      } else if (event is SaveReminderPressed) {
        await _saveReminder(event.reminder);
        _loadReminders();
      } else if (event is DeletePressed) {
        await deleteReminders();
        _loadReminders();
        add(SelectModeDisabled());
      }
    }
  
  </code></pre>
  <p>widget:</p>
  <pre><code>
    Widget _remindersList(BuildContext context) =&gt;
        BlocBuilder&lt;MainBloc, MainState&gt;(
          builder: (context, state) {
            return ListView.builder(
              itemCount: state.reminders.length,
              itemBuilder: (context, index) {
                return ReminderItem(reminders: state.reminders, index: index);
              },
            );
          },
        );
  </code></pre>
  <p>state:</p>
  <pre><code>
  class MainState extends Equatable {
    final bool isSelectedModeActive;
    final List&lt;Reminder&gt; reminders;
    final int quantityOfSelectedItems;
  
    MainState({
      this.isSelectedModeActive = false,
      this.reminders,
    }) : quantityOfSelectedItems =
              reminders.where((reminder) =&gt; reminder.isSelected).length;
  
    MainState copyWith({
      bool isSelectedModeActive,
      List&lt;Reminder&gt; reminders,
    }) =&gt;
        MainState(
          isSelectedModeActive: isSelectedModeActive ?? this.isSelectedModeActive,
          reminders: List&lt;Reminder&gt;()..addAll(reminders ?? this.reminders),
        );
  
    @override
    List&lt;Object&gt; get props =&gt; [
          isSelectedModeActive,
          reminders,
          quantityOfSelectedItems,
        ];
  }
  
  </code></pre>
  <p>wasted several days, trying to solve this. For more detail you can check my project on github: <a href="https://github.com/rockstar4095/reminder_flutter_app/tree/main_screen" rel="nofollow noreferrer">https://github.com/rockstar4095/reminder_flutter_app/tree/main_screen</a></p>