'How use Streambuilder in flutter for Hasuragraphql?
Subscription( options: SubscriptionOptions(document: gql(mySubcription)), builder: (result) { // if (result.hasException) { // return Text(result.exception.toString()); // } if (result.isLoading) { return Center( child: const CircularProgressIndicator(), ); } return Expanded( child: ListView.builder( itemCount: myList.length, itemBuilder: ((context, index) { return ListTile( leading: Text(myList[index]['Roll_No']), // Icon(Icons.list), subtitle: Text(myList[index]['city']), trailing: Icon(Icons.delete_forever), title: Text(myList[index]['name']), ); }), )); })
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|