title: Flutter riverpod incrementing state with notifier
body: <p>In previous versions of <code>Riverpod</code> i can easily increment some data in state by <code>copyWith</code> but in <code>riverpod: ^1.0.3</code> version of this library i can't do that. for example:</p>
  <pre class="lang-dart prettyprint-override"><code>/* click event to increment */
  ref.read(orderStructureProvider.notifier).increment(breadId: id);
  </code></pre>
  <p><code>order</code> notifier:</p>
  <pre class="lang-dart prettyprint-override"><code>final orderStructureProvider = StateNotifierProvider&lt;OrderNotifier, OrderStructure&gt;((ref) =&gt; OrderNotifier());
  
  class OrderNotifier extends StateNotifier&lt;OrderStructure&gt; {
    OrderNotifier() : super(_initial);
  
    static const OrderStructure _initial = OrderStructure(
      address: Address(
        address: 'address',
        province: {},
        city: {},
        neighbourhood: {},
      ),
      breads: [],
      baker: [],
      paymentType: 1,
    );
  
    void resetOrder() =&gt; state = _initial;
  
    int breadsCount() =&gt; state.breads.length;
  
    void updateAddress(
      String _address,
      Map&lt;String, dynamic&gt; _province,
      Map&lt;String, dynamic&gt; _city,
      Map&lt;String, dynamic&gt; _neighbourhood,
    ) {
      state = OrderStructure(
        address: Address(
          address: _address,
          province: _province,
          city: _city,
          neighbourhood: _neighbourhood,
        ),
        breads: [...state.breads],
        baker: [],
        paymentType: state.paymentType,
      );
    }
  
    BreadStructure? getService(int breadId) {
      final index = state.breads.indexWhere((bread) =&gt; bread.id == breadId);
      return index &gt;= 0 ? state.breads[index] : null;
    }
  
    void create(BreadStructure _bread) {
      final newState = OrderStructure(
        address: state.address,
        breads: [...state.breads, _bread],
        baker: [...state.baker],
        paymentType: state.paymentType,
      );
      //newState.breads=[...state.breads,_bread];
      state = newState;
    }
  
    bool breadExists(int breadId) =&gt; state.breads.indexWhere((bread) =&gt; bread.id == breadId) == -1;
  
    void increment({required int breadId}) {
      final newState = OrderStructure(
        address: state.address,
        breads: [...state.breads],
        baker: [...state.baker],
        paymentType: state.paymentType,
      );
  
      debugPrint(state.breads.toString());
      final int index = newState.breads.indexWhere((element) =&gt; element.id == breadId);
      newState.breads[index].copyWith(count: 44);
      //debugPrint(newState.breads.toString());
      state = newState;
    }
  
    void decrement(int breadId) {
      final newState = OrderStructure(
        address: state.address,
        breads: [...state.breads],
        baker: [...state.baker],
        paymentType: state.paymentType,
      );
  
      final index = state.breads.indexWhere((element) =&gt; element.id == breadId);
      BreadStructure bread = newState.breads[index];
      if (index &gt;= 0) {
        if (bread.count &lt;= 1) {
          newState.breads.removeAt(index);
        } else {
          bread = bread.copyWith(count: bread.count - 1);
        }
      }
  
      state = newState;
    }
  }
  
  @freezed
  abstract class OrderStructure with _$OrderStructure {
    const factory OrderStructure({
      required Address address,
      required List&lt;BreadStructure&gt; breads,
      required List&lt;Map&lt;String, dynamic&gt;&gt; baker,
      required int paymentType,
    }) = _OrderStructure;
  
    factory OrderStructure.fromJson(Map&lt;String, dynamic&gt; json) =&gt; _$OrderStructureFromJson(json);
  }
  
  @freezed
  abstract class Address with _$Address {
    const factory Address({
      required String address,
      required Map&lt;String, dynamic&gt; province,
      required Map&lt;String, dynamic&gt; city,
      required Map&lt;String, dynamic&gt; neighbourhood,
    }) = _Address;
  
    factory Address.fromJson(Map&lt;String, dynamic&gt; json) =&gt; _$AddressFromJson(json);
  }
  
  @freezed
  abstract class BreadStructure with _$BreadStructure {
    const factory BreadStructure({
      required int id,
      required String name,
      required int count,
    }) = _BreadStructure;
  
    factory BreadStructure.fromJson(Map&lt;String, dynamic&gt; json) =&gt; _$BreadStructureFromJson(json);
  }
  
  </code></pre>
  <p>output:</p>
  <pre><code>0
  1
  1
  1
  1
  1
  ...
  </code></pre>