Comments (6)
Correct. This is unsupported.
If you wish for your object to be used with AbstractCubit
instead of IntCubit
, have your provider use AbstractCubit
:
BlocProvider<AbstractCubit<int>>(
from provider.
Thanks for the quick reply, but simply providing AbstractCubit
instead of IntCubit
does not work, since I need the IntCubit
functionality in another part of the app (in this example the doStuff
method). But I don't want to use IntCubit
in BlocWidget
, because it does not need it.
My only idea right now is to provide IntCubit
as AbstractCubit
and as IntCubit
but I dislike this approach too, because there could be more classes in the hierarchy.
from provider.
What you're asking is not possible in any case. You'll always have to write extra logic to support both context.watch<AbstractCubit<int>>
and context.watch<IntCubit>
from provider.
Why cannot context.watch<AbstractCubit<int>>
use the IntCubit
? I mean, the IntCubit
is an AbstractCubit<int>
. Is there no simple way how I can use abstractions?
from provider.
That's not how InheritedWidgets work. They use exact type matching. There's no such thing as specifying a type, but getting a subclass instead. You have to manually expose your provider with said type. No way around it.
from provider.
Thank you very much for your explanation
from provider.
Related Issues (20)
- Listen to Changes from a Notifier HOT 3
- DevTools failed to connect with package:provider HOT 3
- Stream issue with StreamProvider HOT 3
- Parameter createdByTestHelpers no longer used in withIgnored method HOT 1
- Mitigate ProviderNotFoundException with context redirection HOT 7
- Null check operator used on a null value
- Make update() methods take a non-nullable previous HOT 5
- Nested models cannot update UI HOT 1
- The values from the provider dev tools extension should be selectable & copyable
- postfix with notify listeners wont show value HOT 1
- Provider.shared for Efficient SharedInstance Management HOT 4
- `context.select` in `ProxyProvider0.update` not allowed? HOT 1
- How to use context.watch in `initState` HOT 2
- the provider instance cannot be obtained correctly in methodChannel.setMethodCallHandler HOT 1
- Why when creating a Consumer, an optional child is asked? When is it used? HOT 2
- How to auto reset the value of Provider ?? This is the ,measure issue i find on Provider, Can you please suggest me how to handle reset all value inside TestProvider without create method manually to reset any value??
- DevTools extension are not buildable with latest Flutter/Dart
- [Meta Tracking Issue] Provider issues from DevTools HOT 1
- Selector is calling its builder every time `notifyListeners()` is called 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 provider.