Comments (2)
Hi @pedromassango 👋
Thanks for opening an issue!
How about something like:
void updateLoginStatus() {
final newState = state.copyWith(
isLoggedIn: _preferences.getBool('_is_logged_in') ?? false,
);
emit(newState);
}
You can also do it in one line like:
void updateLoginStatus() {
emit(state.copyWith(isLoggedIn: _preferences.getBool('_is_logged_in') ?? false));
}
But this sintax doesn't look good and since I can't mutate the state property it is hard to do so. Do you have any suggestion?
Not sure what you mean by this? It should be no different from yielding a new state within mapEventToState
when using the bloc library. Can you please elaborate? Thanks 👍
from cubit.
Closing for now but feel free to comment with additional questions/details and I'm happy to continue the conversation 👍
from cubit.
Related Issues (18)
- Thoughts HOT 3
- Allow cubit to override the provider HOT 2
- Why do we need to specify the cobit state type in the cubitBuilder? HOT 2
- Cubit Delegate/Supervisor missing? HOT 1
- CubitListener behaviour skips(1) HOT 5
- CubitModule? HOT 3
- Observer in Cubit? HOT 3
- Snippets HOT 1
- [DISCUSSION] Should Cubit expose Stream API? HOT 12
- [HELP] Emit state from a stream in repository HOT 2
- Emitted state not received by CubitBuilder HOT 20
- Scale cubit with bloc capabilities HOT 4
- ReplayCubit - List with mutated state can not be redo / undo HOT 11
- Preserve intialState of a cubit HOT 5
- What scopes API should look like? HOT 5
- [PROPOSAL] Merge Cubit into Bloc HOT 32
- Get state without builder 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 cubit.