title: Get iteration index from List.map()
body: <p>I wrote an iteration on list of letters and put inside cards on screen using &quot;map&quot; class.</p>
  <p>In the code you can see that I made a row, and using &quot;map&quot; printed all the userBoard on cards to the screen. I want to add some logic inside so I need to get the id of the element (for taping event).
  Is there a way that I can do that?</p>
  <p>Actually, I want to get a specific index of element over userBoard.</p>
  <p>Code:</p>
  <pre><code>Widget build(BuildContext context) {
      return Row(
        mainAxisAlignment: MainAxisAlignment.spaceEvenly,
        children: &lt;Widget&gt;[
              Row(
                children: userBoard
                    .map((element) =&gt; Stack(children: &lt;Widget&gt;[
                          Align(
                            alignment: Alignment(0, -0.6),
                            child: GestureDetector(
                              onTap: (() {
                                setState(() {
                                  // print(&quot;element=${element.toString()}&quot;);
                                  // print(&quot;element=${userBoard[element]}&quot;);
                                });
                              }),
                              child: SizedBox(
                                width: 40,
                                height: 60,
                                child: Card(
                                    shape: RoundedRectangleBorder(
                                      borderRadius: BorderRadius.circular(5.0),
                                    ),
                                    child: Center(
                                      child: Text(element,
                                          style: TextStyle(fontSize: 30)),
                                    )),
                              ),
                            ),
                          )
                        ]))
                    .toList(),
              )
            ],
          ),
  }
  </code></pre>
  <p><a href="https://i.stack.imgur.com/2rzap.png" rel="noreferrer"><strong>Picture</strong> - each card is &quot;element&quot; of the map. I want to get the indexes for the function onTap.</a></p>