import 'package:bloc/bloc.dart';

abstract class DatePickerEvent{}

class GetCurrentDate extends DatePickerEvent{}

class SetDate extends DatePickerEvent{
  DateTime? date;
  SetDate(this.date);
}

class DatePickerSelesaiBloc extends Bloc<DatePickerEvent, DateTime>{
  DateTime? date;

  DatePickerSelesaiBloc(DateTime initialState) : super(initialState);

  @override
  Stream<DateTime> mapEventToState(DatePickerEvent event) async*{
    // TODO: implement mapEventToState
    if(event is GetCurrentDate) date = DateTime.now();
    else if(event is SetDate) date = event.date;
    yield date!;
  }
}