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

part 'add_raw_material_state.dart';

class AddRawMaterialCubit extends Cubit<AddRawMaterialState> {
  AddRawMaterialCubit() : super(AddRawMaterialInitial());

  final AddRawMaterialRepositories _addRawMaterial =
      AddRawMaterialRepositories();

  Future<void> addRawmaterial() async {
    emit(AddRawMaterialLoading());
    try {
      await _addRawMaterial.addRawMaterial();
      emit(AddRawMaterialSuccess());
    } catch (error) {
      emit(AddRawMaterialFailure(message: error.toString()));
    }
  }
}
