Home > database >  Survey_kit with Flutter / Dart. How to get CurrentStep
Survey_kit with Flutter / Dart. How to get CurrentStep

Time:06-15

I am writing a survey using Flutter for Web and a library called survey_kit. I need to get the value of the CurrentStep to display a relevant image which changes as a the image navigates through the survey.

In the docs there is a class called PresentingSurveyState with property CurrentStep.

Can someone post an example how to access it ? Any help greatly appreciated! pk

CodePudding user response:

I'm not familiar with the library but the usual method you have to access such states is via keys:

Where you instantiate the widget PresentingSurvey you create a key such as: GlobalKey<PresentingSurveyState> and you pass it to the widget:


...
final myPresentingKey = GlobalKey<PresentingSurveyState>();
...

PresentingSurvey{
 key: myPresentingKey
...
}
...

At that point you have access to the state via the key

You can also have a look at this similar answer: https://stackoverflow.com/a/46545141/11187075

  • Related