'setState inside FutureBuilder change the boolean value but not update the Widget

I built this ListView.builder inside the FutureBuilder with a custom checkbox, when pressed on, it needs to change the svg icon. The future has been called on initState to stop firing. But the state update keep not working.

    class _ReportPageViewState extends State<ReportPageView> {
      ReportController reportController = Get.put(ReportController());
      late final Future? myFuture;

      @override
      void initState() {
         super.initState();
         myFuture = reportController.getComplaints();
      }

And this _reportTile() is the problem. It has been inserted on Scaffold body.
 

    Widget _reportTile() {
    return FutureBuilder(
      future: myFuture,
      builder: (ctx, snap) {
        switch (snap.connectionState) {
          case ConnectionState.waiting:
            return Center(
              child: CircularProgressIndicator(),
            );

          default:
            if (snap.hasData && !snap.hasError) {
              final complaints = snap.data as List<ComplaintsModel>;
              return ListView.builder(
                  shrinkWrap: true,
                  physics: NeverScrollableScrollPhysics(),
                  itemCount: complaints.length,
                  scrollDirection: Axis.vertical,
                  itemBuilder: (context, index) {
                    var isChecked = List<bool>.filled(complaints.length, false);
                    return Padding(
                        padding: EdgeInsets.only(left: 32, bottom: 16),
                        child: Row(
                          children: [
                            GestureDetector(
                                onTap: () {
                                  setState(() {
                                    isChecked[index] = !isChecked[index];
                                  });
                                },
                                child: isChecked[index]
                                    ? SvgPicture.asset(
                                        "assets/images/commom_svg/rounded_checkbox_checked.svg",
                                        height: 26,
                                      )
                                    : SvgPicture.asset(
                                        "assets/images/commom_svg/rounded_checkbox_unchecked.svg",
                                        height: 26,
                                      )),
                            SizedBox(width: 14),
                            Text(complaints[index].title!,
                                style: TextStyle(fontSize: 18))
                          ],
                        ));
                  });
            }
            if (snap.hasError) {
              return Center(
                child: Icon(Icons.error),
              );
            }
            return Container();
        }
      },
    );
  }


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source