SHARE
TWEET

Untitled

a guest Jun 19th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import 'package:bloc/bloc.dart';
  2.  
  3. import 'package:scanbu/widgets/screen/screen.event.dart';
  4. import 'package:scanbu/widgets/screen/screen.state.dart';
  5.  
  6. class ScreenBloc extends Bloc<ScreenEvent, ScreenState> {
  7.   ScreenState get initialState => ScreenState.initial();
  8.  
  9.   void enableLoader() {
  10.     dispatch(ScreenLoader(
  11.       isLoading: true,
  12.     ));
  13.   }
  14.  
  15.   void disableLoader() {
  16.     dispatch(ScreenLoader(
  17.       isLoading: false,
  18.     ));
  19.   }
  20.  
  21.   @override
  22.   Stream<ScreenState> mapEventToState(
  23.       ScreenState state, ScreenEvent event) async* {
  24.     if (event is ScreenLoader) {
  25.       if (event.isLoading) {
  26.         yield ScreenState.loading();
  27.       } else {
  28.         yield ScreenState.notLoading();
  29.       }
  30.     }
  31.   }
  32. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top