Another exception was thrown: setState() or markNeedsBuild() called during build Error in flutter

Try to use initial function calling in initState instead of build function

@override
  void initState() {
    WidgetsBinding.instance!.addPostFrameCallback((_) {
    Provider.of<SearchProvider>(context, listen: false).cleanSearchProduct();
    Provider.of<SearchProvider>(context, listen: false).initHistoryList();
    });
    super.initState();
  }