I created a function and call in the buildSuggestions
Widget buildSuggestions(BuildContext context) {
_buildContext = context;
executeAfterBuild();
In the function I call a Future.delayed because Flutter needed time for contruct the context again
Future<void> executeAfterBuild() async {
if (retornoglobal == true) {
Future.delayed(const Duration(milliseconds: 500), () {
// this code will get executed after the build method
// because of the way async functions are scheduled
_chamaformulario(
snapshotglobal,
indexglobal,
);
});
}
}
It´s Worked