I have a scenario which I want to remove drawer programmatically.
I use a stream builder to get the value and decide to show or remove the drawer, for example when stream value is true I return my drawer widget otherwise return null to remove drawer but stream builder won't allow me to return null and if I return empty Container flutter won't remove drawer icon from app bar, so how can I achieve my goal and remove the drawer with a stream builder.
here is my code
new Scaffold(
appBar: PreferredSize(
child: MyAppBar(
title: "Settings",
),
preferredSize: Size.fromHeight(55),
),
drawer: StreamBuilder(
stream: settingService.getSettings,
builder: (BuildContext context, snapshot) {
if (snapshot.hasData) {
final drawer= snapshot.data;
if (drawer.visibility) {
return myAppDrawerWidget(
activeIndex: 13,
);
}
}
},
),
);