I have a StreamBuilder in my Widget body
body: RefreshIndicator(
onRefresh: () => _sheetDetailBloc.fetchSheetDetail(
widget.selectedSheet, widget.selectedSheetTitle),
child: StreamBuilder<ApiResponse<Sheet>>(
stream: _sheetDetailBloc.sheetDetailStream,
builder: (context, snapshot) {
if (snapshot.hasData) {
switch (snapshot.data.status) {
case Status.LOADING:
return Loading(loadingMessage: snapshot.data.message);
break;
case Status.COMPLETED:
return ShowSheetDetail(displaySheet: snapshot.data.data);
break;
case Status.ERROR:
return Error(
errorMessage: snapshot.data.message,
onRetryPressed: () => _sheetDetailBloc.fetchSheetDetail(
widget.selectedSheet, widget.selectedSheetTitle),
);
break;
}
I have a drawer in my appbar where i want to display the contactNoToDisp and emailIDToDisp which will arrive after asyc call as snapshot.data.data.contactNo and snapshot.data.data.emailID
drawer code is below:
endDrawer: Drawer(
child: ListView(
children: <Widget>[
ListTile(
title: Text("First Item"),
),
ListTile(title: Text(contactNoForDisp)),
ListTile(title: Text(emailIDForDisp)),
],
)),
I am not sure how to update the two class variables contactNoToDisp and emailIDToDisp after the future/asyc has returned so that the same can be dispalyed in the drawer