You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
BlocBuilder<LikedUsersBloc, LikedUsersState>(
builder: (BuildContext context, LikedUsersState state) {
print(state.status);
switch (state.status) {
caseLikedUsersStatus.initial:caseLikedUsersStatus.loading:returnconst_LoadingShimmer();
caseLikedUsersStatus.success:caseLikedUsersStatus.failure:if (accountStore.user.paused ==true) {
returnListView(
children: [
AllDoneTextButtonWidget(
"Your account is currently paused.",
buttonText:"Tap here to unpause",
onPressed: () {
Navigator.of(context, rootNavigator:true).push(
MaterialPageRoute(
builder: (context) =>constSettingsAccountView(),
),
);
},
),
],
);
}
if (state.likedUsers.isEmpty) {
returnconst_EmptyPlaceholder("Like some profiles to see them here!");
}
returnListView.builder(
padding:constEdgeInsets.only(bottom:24, top:12),
itemCount: state.likedUsers.length,
itemBuilder: (context, index) {
finalUserModel user = state.likedUsers.elementAt(index);
Expected Behavior
The BlocBuilder lazily calls LikedUsersBloc. And the Constructor of LikedUsersBloc shows that the status is initial
The event const LikedUsersEvent.streamRequested() is added.
A new status of loading is emitted. (This part never happens)
The _likedUsersRepo.getLikedUsers() is called.
The repo does _init() and a value is added to the BehaviorSubject.
The bloc's ondata is called and the status turns to success.
The issue is that I want to show the Shimmer while the status is loading, but I am not able to do so, since it goes from Initial to Success before it's actually added.
Description
I have a BlocBuilder that needs to handle the different statuses of my Bloc's state.
The issue is that the loading status is never called.
Here is part of my Bloc
And this is part of my Repo
Here is part of my main.dart
Here is part of my UI
Expected Behavior
LikedUsersBloc
shows that the status isinitial
const LikedUsersEvent.streamRequested()
is added.loading
is emitted. (This part never happens)_likedUsersRepo.getLikedUsers()
is called._init()
and a value is added to the BehaviorSubject.success
.The issue is that I want to show the Shimmer while the status is loading, but I am not able to do so, since it goes from Initial to Success before it's actually added.
Video
Bloc.mp4
Notes
I'm following this pattern: https://bloclibrary.dev/tutorials/flutter-todos/#localstoragetodosapi
The text was updated successfully, but these errors were encountered: