// define field instance GlobalKey<ConvexAppBarState> _appBarKey = GlobalKey<ConvexAppBarState>(); // construct with key ConvexAppBar(key: _appBarKey, /* ... */); // access related State when necessary such as onPageChanged _appBarKey.currentState.animateTo(2/* index*/);