I am trying to make that when I submit the button, the isLoading variable is set to true, and when the block issues the state it returns to false, to show a circular progress indicator. My problem is that I don't know WHERE or HOW to put that variable, nor how to tell the bloc that this variable is true before / outside the BlocBuilder,
this is the code of my button:
TextButton(
child: Text("submit"),
onPressed: () {
context
.read<ShowMusicHomeBloc>()
.add(OnSearchTracks(q: _searchText.text));
_searchText.clear();
},
),
Could you give me a practical example how I can set this variable isLoading to true using flutter_bloc?