Get Selected Item From ListView
Complete Code For Get Selected Item From ListView In Flutter
main.dart
import 'package:flutter/material.dart'; void main() => runApp(MyApp()); class MyApp extends StatelessWidget { @override Widget build(BuildContext context) { return MaterialApp( debugShowCheckedModeBanner: false, home: Scaffold( appBar: AppBar(title: Text('Get ListView Selected Item')), body: Center( child: ListViewWidget() ) ) ); } } class ListViewWidget extends StatefulWidget { ListViewState createState() => ListViewState(); } class ListViewState extends State { List<String> items = [ 'Apple', 'Banana', 'Mango', 'Orange', ]; getListViewItems(String item){ showDialog( context: context, builder: (BuildContext context) { return AlertDialog( title: new Text(item), actions: <Widget>[ FlatButton( child: new Text("OK"), onPressed: () { Navigator.of(context).pop(); }, ), ], ); }, ); } @override Widget build(BuildContext context) { return Scaffold( body: Center( child: ListView( children: items .map((data) => ListTile( title: Text(data), onTap: ()=>{ getListViewItems(data) } )) .toList(), ), ) ); } }