import 'package:bloc/bloc.dart';
import 'package:equatable/equatable.dart';
import 'package:easycook_mobile/repositories/dapurku_repository.dart';

part 'dapurku_state.dart';

class DapurkuCubit extends Cubit<DapurkuState> {
  DapurkuCubit() : super(DapurkuInitial());

  final DapurkuRepositories _dapurku = DapurkuRepositories();

  Future<void> dapurku({rawMaterial}) async {
    emit(DapurkuLoading());
    try {
      await _dapurku.dapurku(rawMaterial);
      emit(DapurkuSuccess());
    } catch (error) {
      emit(DapurkuFailure(message: error.toString()));
    }
  }
}
