Whenever my keyboard is open and I try to close the Drawer - EndDrawer it throws this error. The error doesn't occur if the keyboard is not focused.
======== Exception caught by widgets library =======================================================
The following assertion was thrown building StreamBuilder<List<SearchFieldListItem<dynamic>?>?>(dirty, state: _StreamBuilderBaseState<List<SearchFieldListItem<dynamic>?>?, AsyncSnapshot<List<SearchFieldListItem<dynamic>?>?>>#75ea8):
This widget has been unmounted, so the State no longer has a context (and should be considered defunct).
Note: There is SearchField inside the drawer.
It shouldn't throw an error.
This is the code
appBar:AppBar(title:Text('XYZ')),
endDrawer: Drawer(
child: ListView(
children: [
Padding(
padding:EdgeInsets.all(10),
child: SizedBox(
child: const DrawerHeader(
child: Text('Filter'),
),
),
),
Padding(
padding: EdgeInsets.all(10),
child: Container(
child: SearchField<Model>(
onSuggestionTap: (buyerValue) {},
,
),
),
),
],
),
),
body: Container(
)
),