The method ‘build’ is always abstract in the supertype in Flutter

Total
12
Shares

i trying to do rebuild my TabController screen every time in the flutter so for that i
need to add super.build(context); inside the Widget build(BuildContext context) method. but I having an error during compile time

I received below error

The method 'build' is always abstract in the supertype. (Documentation)

Here is my code

class TrendingScreen extends StatefulWidget {
@override
_TrendingScreenState createState() => _TrendingScreenState();
}

class _TrendingScreenState extends State<TrendingScreen> {

  @override
  Widget build(BuildContext context) {
    super.build(context);

    return Scaffold(
        backgroundColor: colorSecondary,
        appBar: customAppbar(),
        body: Container(
            height: double.infinity,
            width: double.infinity,
            child: buildTrendingList()));
  }
}

Solution

There is i missing an Add the mixin with AutomaticKeepAliveClientMixin to the state class then you can call the super.build(context);

Leave a Reply

Your email address will not be published. Required fields are marked *