Comments (14)
Actually the pagination is outdated and can be simplified. Families weren't implemented at the time of writing.
I'll also include a "auto cancel HTTP requests if the request is no-longer needed by the UI" and some navigation.
from riverpod.
Ah good idea too
So:
- debounce on search (currently we have a search, just not denounced)
- retry
- pull to refresh
- offline
- cancel HTTP requests when no-longer-used
- data normalization
- deep-link to a character
That should keep me occupied for this weekend
from riverpod.
I opted for a separate list for the search bar
What do you think of it?
I like it as it demonstrate having two separate states in parallel - which is done by default with Riverpod's families
The main list is obtained with:
useProvider(characters(''));
And the filtered list with:
useProvider(characters(search));
from riverpod.
Good idea!
Any other things you'd like in it?
from riverpod.
@rrousselGit Not really, debounce
is something that came to my head because I use it all the time on my projects (although relying on rxdart
).
The existing pagination example is very nice + the combination with freezed for the API responses.
I can't think of other common use cases at the moment.
from riverpod.
How about a Retry
on errors? As far as I can see the error would only be shown, without a way to get rid of it? Not sure how this fits into the pagination
from riverpod.
Saving state to disk and recreate the state when come back later :)
I wish there was a sync way to do it :(
from riverpod.
You could technically use File.writeSync
Do you want to though... Haha
from riverpod.
Uhhhhhh :D
class Foo extends StateNotifier<FooState> {
Foo(): super(FooState.fromJson(file.readAsStringSync()) ?? Foo())
}
from riverpod.
I'm honestly considering making a wrapper around a DB, such that we'd have:
final provider = StreamProvider((ref) async* {
final json = await ref.deserialize();
yield Value.fromJson(json);
}, name: "ID", serialize: (value) => value.toJson());
from riverpod.
off topic, but this sounds a bit like why I made https://github.com/hpoul/simple_json_persistence#usage-in-flutter-streambuilder which basically produces a json backed ValueStream.. only that you'd have call save
to update the state, instead of calling the setter..
from riverpod.
I updated the marvel example a bit.
I'm not done yet, but it's a pretty big simplification of how the pagination was done before
from riverpod.
Looking good. Can't wait to see how you solve reloading the character page on error :)
from riverpod.
Closing for now. The current example does include a denounced search.
I will implement the remaining points in different examples.
from riverpod.
Related Issues (20)
- ref.listen not invoked when state changed with the same value HOT 1
- Minor - Notifier Dependency must be `keepAlive:true` if watched by a parent that is `keepAlive:true` HOT 1
- Riverpod annotation in large scale applications HOT 2
- @protected annotation not compatible with linter rule avoid_public_notifier_properties HOT 4
- Provide a way to "inject" providers into a ProviderScope/ProviderContainer HOT 1
- Infinite loop when combining two Future providers in a specific way HOT 3
- Various typos in documentation
- Closed HOT 1
- Unexpected "Providers are not allowed to modify other providers during their initialization" error
- Feature to automatically create a Mermaid.js diagram showing all providers and relationships HOT 5
- Various incomplete translations in documentation
- Warn against using `ref.watch` on a provider's notifier HOT 13
- `ProviderContainer.pump()` doesn't seem to actually pump entirely HOT 1
- Incorrect avoid_manual_providers_as_generated_provider_dependency trigger when using family provider HOT 2
- Code generation InvalidType for Freezed union/sealed type HOT 2
- Invalidating an AutoDisposeProvider A that watches AutoDisposeProvider B doesn't dispose AutoDisposeProvider B automatically. HOT 1
- iOS rendering issue HOT 1
- StateError (Bad state: Cannot use "ref" after the widget was disposed.) HOT 1
- docs: Providers are not paused properly if no longer listened. HOT 9
- Feature Request: Delay Autodispose Provider Disposal with Reset and Upper Limit HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from riverpod.