i'm trying to print an SMS, but i'm just printing "instance of..."
this is an app which show all sms in the smartphone on the display
i'm using the sms plugin
class _HomeState extends State<Home> {
Future<List> getSMS() async {
SmsQuery query = new SmsQuery();
List<SmsMessage> messages = await query.getAllSms;
return messages;
}
@override
void initState() {
super.initState();
}
@override
Widget build(BuildContext context) {
return new Scaffold(
body: FutureBuilder<List>(
future: getSMS(),
builder: (context, snapshot) {
switch(snapshot.connectionState){
case ConnectionState.none:
case ConnectionState.waiting:
default:
if(snapshot.hasError){
return new Center(
child: Text("Erro ao Carregar Dados :(",
style: TextStyle(
color: Colors.black,
fontSize: 25.0),
textAlign: TextAlign.center,)
);
} else {
debugPrint(snapshot.data[0].toString());
}
}
return new Center(
child: Text(snapshot.data[0].toString(),
style: TextStyle(
color: Colors.black,
fontSize: 25.0),
textAlign: TextAlign.center,)
);
},
),
);
}
}
all i need is to print the sms on display, but i don't know how to print an instance of object in dart