Is it possibile to call the future of a FutureBuilder and retrieve the snapshot before the actual build of the builder? In order to avoid the waiting of connectionState.waiting.
In code:
@override
Widget build(BuildContext context) {
return Scaffold(
body: Column(
children: [
Expanded(
child: SingleChildScrollView(
child: Column(
children: [
Padding(
child: ClipPath(
clipper: ShapeBorderClipper(
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(8),
),
),
child: Theme(
data: Theme.of(context).copyWith(
dividerColor: Colors.transparent),
child: ExpansionTile(
title: const Text(
"In corso",
children: [
FutureBuilder(
future: _future,
builder: (context,
AsyncSnapshot<
List<DocumentSnapshot>>
snapshot) {
if (snapshot.hasData) {
List<String> schedineincorso = [];
for (var DOC in snapshot.data!) {
schedineincorso.add(DOC.id);
}
return Column(
children: [
// children...
],
);
} else {
return const CircularProgressIndicator();
}
})
],
),
),
),
),
],
),
);
}
I'd like the data to be ready before the user expands the Expansion Tile, because at the moment when a user clicks on the Expansion Tile it shows the CircularProgressIndicator for a while.