Title: Showing progress bar until image loads. Flutter
Tags: android;flutter;dart;future;flutter-http
Question: 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.
Comment: What you're asking isn't clear.

Comment: @Alok-P it is said down below but you should use FutureBuilder. The example code on the docs should do the trick

Comment: Sorry @Eren , I mean until I get the response/bytes I want to display a progress bar..

Comment: It is preferred to enter code snippets and not screen shots. Ideally you also exclude any boilerplate not necessary for understanding your issue


Here is another answer: You can try FutureBuilder to show progress until you get response from API.
FutureBuilder(
future: Future<String&gt;.delayed(
Duration(seconds: 5),
() =&gt; 'Data Loaded',
),
builder: (context, snapShot) {
return !state.recentSearchCalled
? buildLoadingUi(context)
: buildSearchUI(context, state);
},
),

Here is another answer: Add &quot;loading&quot; status
setState(() { isloading = true });
await getCaptcha();
setState(() { isloading = false });

{'source': 'StackExchangeDataset', 'subset': 'stackoverflow.com', 'metadata': {'AnswerCount': 2, 'CommentCount': 4, 'ContentLicense': 'CC BY-SA 4.0', 'CreationDate': '2020:00:12/28/20', 'FavoriteCount': None, 'PostTypeId': 1, 'Tags': '<android><flutter><dart><future><flutter-http>', 'Title': 'Showing progress bar until image loads. Flutter', 'ViewCount': 538, 'id': 65476347, 'user_AboutMe': None, 'user_AccountId': None, 'user_DisplayName': None, 'user_Reputation': None, 'user_Views': None, 'user_id': None}}