@@ -135,32 +135,33 @@ Before, Riverpod was inconsistent in how it filtered updates to providers.
135135Some providers used ` == ` to filter updates, while others used ` identical ` .
136136In Riverpod 3.0, [ all providers now use ` == ` to filter updates] ( ./whats_new.mdx#all-updateshouldnotify-now-use- ) .
137137
138- This generally shouldn't change anything in your code. But if you need to,
139- you can override ` Notifier.updateShouldNotify ` to customize the behavior.
138+ The most likely way for you to be impacted by this change is when using
139+ [ StreamProvider] /[ StreamNotifier] , as now stream values will be filtered by ` == ` .
140+ If you need to, you can override ` Notifier.updateShouldNotify ` to customize the behavior.
140141
141142<AutoSnippet
142143 language = " dart"
143144 codegen = { `
144145 @riverpod
145146 class TodoList extends _$TodoList {
146147 @override
147- List <Todo> build() => [] ;
148+ Stream <Todo> build() => Stream(...) ;
148149
149150 @override
150- bool updateShouldNotify(List <Todo> previous, List <Todo> next) {
151+ bool updateShouldNotify(AsyncValue <Todo> previous, AsyncValue <Todo> next) {
151152 // Custom implementation
152153 return true;
153154 }
154155 }
155156 ` }
156157
157158 raw = { `
158- class TodoList extends Notifier<List< Todo> > {
159+ class TodoList extends StreamNotifier< Todo> {
159160 @override
160- List <Todo> build() => [] ;
161+ Stream <Todo> build() => Stream(...) ;
161162
162163 @override
163- bool updateShouldNotify(List <Todo> previous, List <Todo> next) {
164+ bool updateShouldNotify(AsyncValue <Todo> previous, AsyncValue <Todo> next) {
164165 // Custom implementation
165166 return true;
166167 }
@@ -376,6 +377,7 @@ if (value.error is NotFoundException) {
376377
377378[ TickerMode ] : https://api.flutter.dev/flutter/widgets/TickerMode-class.html
378379[ StreamProvider ] : https://pub.dev/documentation/flutter_riverpod/latest/flutter_riverpod/StreamProvider-class.html
380+ [ StreamNotifier ] : https://pub.dev/documentation/flutter_riverpod/latest/flutter_riverpod/StreamNotifier-class.html
379381[ StreamNotifierProvider ] : https://pub.dev/documentation/flutter_riverpod/latest/flutter_riverpod/StreamNotifierProvider.html
380382[ ProviderObserver ] : https://pub.dev/documentation/flutter_riverpod/latest/flutter_riverpod/ProviderObserver-class.html
381383[ ProviderContainer ] : https://pub.dev/documentation/flutter_riverpod/latest/flutter_riverpod/ProviderContainer-class.html
0 commit comments