I'm new to Flutter, and I can't achieve display the snapshot.data value in a widget outside from futureBuilder scope, It's possible to do this? if not, what is the better way to do this?
//...
var result = '0.00';
Row(children: [
const Text('RESULT: '),
FutureBuilder(
future: Obj.mapaProvider(widget
.property1
.toString()),
builder: (context, snapshot) {
if (snapshot.connectionState == ConnectionState.done) {
result = snapshot.data.toString();
return Text(
result,
style: const TextStyle(
fontWeight: FontWeight.bold,
),
);
} else {
return const Text("WITHOUT RESULT");
}
}),
]),
const Divider(
height: 20,
thickness: 5,
),
// In this widget need the new value of result variable from futurebuilder snapshot.data
OtherWidget(result), // PERHAPS SHOWS 0,00 **
//...