I have added a `setState` Method inside the `build` widget after getting my data from API response via StreamBuilder. But it gives this error:

> 
> Unhandled Exception: `setState()` or `markNeedsBuild()` called during build.
> 
> 
> 

How do I avoid this situation?

My code:

```
Widget build(BuildContext context) {
return Scaffold(
    backgroundColor: Colors.white,
    body: StreamBuilder(
        stream: bloc.getData,
        builder: (context, AsyncSnapshot<Home> dataSnapshot) {
          if (dataSnapshot.hasData) {
            if (dataSnapshot.data.description != null) _expandHeightBy(40); 
            ........ 

```

Function

```
      _expandHeightBy(double increase) async {
    setState(() {
      _expandedHeightVal += increase;
    });
  }

```