title: How can I use variable of CubitState inside Cubit? Flutter/Bloc
body: <p>so I don't have any idea how to take argument from mine Cubit state which is AnswerPicked in this case, there is a code from states file.</p>
  <pre><code>part of 'answer_cubit.dart';
  
  abstract class AnswerState extends Equatable {
    const AnswerState();
  
    @override
    List&lt;Object&gt; get props =&gt; [];
  }
  
  class AnswerInitial extends AnswerState {}
  
  class AnswerPicked extends AnswerState {
    final String answer;
    AnswerPicked({
      this.answer,
    });
    String toString() =&gt; '{AnswerPicked: $answer}';
  }
  </code></pre>
  <p>I want to use it in Cubit function right there:</p>
  <pre><code>part 'answer_state.dart';
  
  class AnswerCubit extends Cubit&lt;AnswerState&gt; {
    final ExamScoreCubit scoreCubit;
    AnswerCubit({
      @required this.scoreCubit,
    }) : super(AnswerInitial());
  
    List&lt;String&gt; userAnswersList = [];
  
    void pickAnswer(String answer) {
      emit(AnswerInitial());
      emit(AnswerPicked(answer: answer));
    }
  
    void takeAnswer(String questionAnswer, int type) {
      if(state is AnswerPicked){
        userAnswersList.add(state.answer); // state.answer don't work
        scoreCubit.checkAnswer(AnswerPicked().answer, questionAnswer, type); // AnswerPicked().answer don't work
      }
      emit(AnswerInitial());
    }
  }
  </code></pre>
  <p>In void takeAnswer() I don't want to pass it throw argument inside the widget tree using context. Any ideas how to do it?</p>