The argument type 'x' can't be assigned to the parameter type 'y'
There is a problem with this line
Text(snapshot.data.isPause);
I don't know how to fix it.
-----------------------------------------CODE-------------------------------------------
MaterialApp(
debugShowCheckedModeBanner: false,
home: Scaffold(
body: Center(
child: FutureBuilder<Post>(
future: fetchPost(),
builder: (context, snapshot) {
if (snapshot.hasData)
return Text(snapshot.data.isPause);
else if (snapshot.hasError) {
return Text("${snapshot.error}");
}
return CircularProgressIndicator();
}),
)),
)
The argument type x
can't be assigned to the parameter type y
Your isPause
isn't returning String
, it needs to return String
because Text()
accepts String
, for quick hack, you can try below solution.
Text(snapshot.data.isPause.toString());