how to use future builder in flutter code example
Example 1: flutter future builder
FutureBuilder(
future: _fetchNetworkCall, // async work
builder: (BuildContext context, AsyncSnapshot snapshot) {
switch (snapshot.connectionState) {
case ConnectionState.waiting: return Text('Loading....');
default:
if (snapshot.hasError)
return Text('Error: ${snapshot.error}');
else
return Text('Result: ${snapshot.data}');
}
},
),
Example 2: future builder flutter
class ProjectModel { String id; String createdOn; String lastModifiedOn; String title; String description; ProjectModel({ this.id, this.createdOn, this.lastModifiedOn, this.title, this.description, });}