🅵
Size: a a a
🅵
🅵
yield stateStartLoad();
await api.loadData();
yield stateFinishLoad();
HttpProvider httpProvider;
State<State> mapEventToState(Event event) async* {
if (event is RightEvent) yield* rightEventHook(event);
}
State<RightState> rightEventHook(RightEvent event) async* {
yield Fetching();
await httpProvider.do();
yield Ok();
}
🅵
r
🅵
КБ
r
🅵
🅵
🅵
🅵
КБ
r
🅵
🅵
myBloc
.whereType<RightState>()
.forEach((RightState myState) => ...);
🅵
Stream<T> whereState<T>() =>
whereType<T>();
r
myBloc
.whereType<RightState>()
.forEach((RightState myState) => ...);
🅵
///
mixin AuthorizedState {}
///
class Authorized extends AppState with AuthorizedState, AppRoutingState {
final User user;
const Authorized(this.user)
: assert(user is User);
}
///
class NotAuthorized extends AppState with AuthorizedState, AppRoutingState {
final bool showAuthScreen;
const NotAuthorized({bool showAuthScreen = false})
: showAuthScreen = showAuthScreen ?? false;
}
🅵
StreamBuilder(
stream: myBloc.whereState<AuthorizedState>(),
builder: ...
)
🅵