import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';

import '../../../../model/profile/basic_information/adress.dart';

part 'address_event.dart';
part 'address_state.dart';

class AddressBloc extends Bloc<AddressEvent, AddressState> {
  AddressBloc() : super(AddressInitial()) {
        List<MainAdress> addresses = [];
    on<GetAddress>((event, emit) {
      emit(AddressLoadingState());
     try{
       addresses = event.addresses;
      emit(AddressLoadedState(addresses: addresses));
     }catch(e){
      emit(AddressErrorState(message: e.toString()));
     }
    });
  }
}
