Flutter - How to trigger a child's void and without rebuild the three

Hello !
After days of search I’m getting help. I work on a flutter application.


  • A grid view feeded with Json
    • childs : GridTile with Flipcard in (https://pub.dev/packages/flip_card)
      • On tap on GridTile there is a callback to get the selected Item and an animation because of the flipcard onTap

What I would:

  1. When an item is aleready selected (flipcard flipped so we show the back of the card),
  2. And I selected another item of the grid te(so flipcard of this itme also flipped)
  3. I would like to flip back the old selected item Flipcard without rebuild the tree because I would lost the state of the new selected item.

I tried many thing. For example I tried to use GlobalKey on GridTiles to interract with after build but currentState is always null when I want to interact with.

I wonder what is the good practice in this case ?

I hope I was clear :slight_smile: (I’m french)

Thank you the community!


Something to know…

It is possible to interract with the flipcard (child of gridtile) like this

GlobalKey cardKey = GlobalKey();

Widget build(BuildContext context) {
return FlipCard(
key: cardKey,
flipOnTouch: false,
front: Container(
child: RaisedButton(
onPressed: () => cardKey.currentState.toggleCard(),
child: Text(‘Toggle’),
back: Container(
child: Text(‘Back’),


Your question is quite interesting.

The approach I would take here is to have an index value which holds the currentFlipcard (The one which is tapped). And match that index while building the Grid tiles, and if it matches mark it as flipped.

on next Tap just setState the value of currentFlipcard and voila it should automatically get rebuild and you will also preserve the value of the currentFlipcard.