Comments (6)
Why are you overriding "name" as "emphasis"?
from riverpod.
Why not? 🙂 It is just a simple example here, but there can be cases where I want to override a behavior to add some features but still calling the original provider (e.g: modify a real HTTP response, transform a value, ...).
I think I would use this for mocks but it can still be used for real use cases I guess.
from riverpod.
For sure. I'm just trying to understand the use-case as much as possible.
To make sure that there isn't a different solution that we could take
from riverpod.
Note that you could do it with two providers:
final provider = Provider((ref) => 'Foo');
final originalProvider = Provider((ref) => ref.read(provider).value);
So when you override provider
, originalProvider
is still not overriden
ProviderScope(
overrides: [
provider.overrideAs(Provider((ref) {
final original = ref.read(originalProvider).value;
return 'Hello $original';
}),
],
child: //
)
from riverpod.
I think use-case of overrideAs
is for testing and both of them should be unrelated to each other.
from riverpod.
Closing for now as I don't think this is truly needed since there are other solutions, and implementing that would decrease overall performances.
from riverpod.
Related Issues (20)
- examples/pub dependencies and auth problems HOT 1
- The subclass of AutoDisposeNotifier can always obtain internationalization, even if the phone's system Settings are Chinese, and finally English HOT 2
- Option to ignore previous state in AsyncValue by default HOT 3
- Support async `onDispose` HOT 3
- invalidation forwarding HOT 5
- docs: invalid use of `Uri.https` in readme HOT 1
- Read a HOT 1
- Read a "disposed" notifier HOT 1
- Refactoring Propositions dropping out when updating flutter HOT 2
- Add exception handling to 'ref.refresh()' HOT 6
- Add something like `ref.watchStream(...)` HOT 10
- ProviderScope state wrongly disposed possible bug HOT 3
- Add Japanese docs
- [riverpod_generator] `dependencies` does not respect `provider_family_name_suffix` option
- StateNotifierProvider always refreshs when invalidated problem still exists HOT 3
- Error: 'LintCode' is imported from both 'package /src/dart/error/lint_codes.dart' and 'package /src/lint_codes.dart' on Flutter 3.24.0 with build_runner HOT 3
- VS Code refactoring options are not available with Flutter 3.24 stable release HOT 4
- `initialValue`-like behaviour for the FutureProvider HOT 7
- `flutter` dependency included when using Riverpod in a server-side environment HOT 1
- ref.watch doesn't work HOT 2
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.