// import 'dart:async'; import 'package:bloc/bloc.dart'; import 'package:bytedesk_kefu/blocs/contact_bloc/bloc.dart'; import 'package:bytedesk_kefu/repositories/contact_repository.dart'; class ContactBloc extends Bloc { final ContactRepository contactRepository = new ContactRepository(); ContactBloc() : super(ContactUninitialized()) { on(_mapRefreshContactToState); } // @override // Stream mapEventToState(ContactEvent event) async* { // // // if (event is RefreshContactEvent) { // yield* _mapRefreshContactToState(event); // } else { // // // } // } void _mapRefreshContactToState( RefreshContactEvent event, Emitter emit) async { emit(ContactLoading()); try { // final List contactList = await contactRepository.getContacts(); // yield ContactLoadSuccess(contactList); } catch (error) { print(error); emit(ContactLoadError()); } } }