0

I want to make a register screen with captcha and the api I am using is sending the raw image bytes and in header a secret value to validate the captcha. I want to take the bytes from http.get and show them to image.memory in my register screen and also save the timeStamp for submitting data.


I have a register.dart file where I have all the UI. Then a getCaptcha.dart file containing a future function to get the captcha and header.

enter image description here


getCaptcha.dart


register.dart initstate


register.dart problem


2 Answers2

0

You can try FutureBuilder to show progress until you get response from API.

FutureBuilder(
              future: Future<String>.delayed(
                Duration(seconds: 5),
                () => 'Data Loaded',
              ),
              builder: (context, snapShot) {
                return !state.recentSearchCalled
                    ? buildLoadingUi(context)
                    : buildSearchUI(context, state);
              },
            ),
abdulec90
  • 262
  • 3
  • 11
0

Add "loading" status

setState(() { isloading = true });
await getCaptcha();
setState(() { isloading = false });
januw a
  • 2,056
  • 5
  • 18
  • 39