flutter 3.19 upgrade
This commit is contained in:
Christien Rioux 2024-02-27 21:37:39 -05:00
parent c6f017b0d1
commit efb7b95980
17 changed files with 131 additions and 127 deletions

View file

@ -54,12 +54,13 @@ mixin BlocBusyWrapper<S> on BlocBase<BlocBusyState<S>> {
await closure(busyemit);
// If the closure did one or more 'busy emits' then
// take the most recent one and emit it for real
// take the most recent one and emit it for real and
// turn off the busy state
final finalState = changedState;
if (finalState != null && finalState != state.state) {
emit(BlocBusyState._busy(finalState));
emit(BlocBusyState(finalState));
} else {
emit(BlocBusyState._busy(state.state));
emit(BlocBusyState(state.state));
}
});
void changeState(S state) {

View file

@ -1,6 +1,7 @@
import 'dart:async';
import 'package:async_tools/async_tools.dart';
import 'package:bloc/bloc.dart';
import 'package:fast_immutable_collections/fast_immutable_collections.dart';
// Mixin that automatically keeps two blocs/cubits in sync with each other
@ -21,6 +22,9 @@ abstract mixin class StateFollower<S extends Object, K, V> {
_subscription = stream.listen(_updateFollow);
}
void followBloc<B extends BlocBase<S>>(B bloc) =>
follow(initialInputState: bloc.state, stream: bloc.stream);
Future<void> close() async {
await _subscription.cancel();
}