'Flutter Duplicate Global Key detected on widget tree

I have this issue when implementing flutter's showcaseview despite following its official documentation. The errors I get have to do with a duplicate global state and here's a sample if my code:

  final GlobalKey _timeline_filter = GlobalKey();
  void initState() {
    super.initState();

    WidgetsBinding.instance.addPostFrameCallback((_) {
      Future.delayed(const Duration(milliseconds: 400), () {
        print("showcasing..");
        ShowCaseWidget.of(context).startShowCase([_timeline_filter]);
      });
    });
  }

Build method Code:

  @override
  Widget build(BuildContext context) {
    return Material(
      child: Container(
        child: ListView(
          controller: scroll_controller,
          shrinkWrap: true,
          children: <Widget>[
            Container(
                child: Column(
              children: [
                Container(
                    margin: EdgeInsets.only(
                      left: 83.5.w,
                    ),
                    child: SizedBox(
                      width: 10.w,
                      child: FloatingActionButton(
                        elevation: 0.4.h,
                        backgroundColor: Colors.white,
                        foregroundColor: Colors.black,
                        onPressed: () {
                          Navigator.push(
                              context,
                              MaterialPageRoute(
                                  builder: (context) => FilterTags()));
                        },
                        child: Showcase(
                            key: _timeline_filter,
                            description: "tap to filter by category",
                            child: Icon(FontAwesomeIcons.filter, size: 11.sp)),
                      ),
                    )),
              ],
            )),
            buildTimelinePosts(),
          ],
        ),
      ),
    );
  }


Sources

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

Source: Stack Overflow

Solution Source