I want to get TimeStamp from mysql & Change it into time ago My TimeStamp is look like:
2021-03-04 06:06:48
And in Flutter:
[{id: 1, caption: first post, useruid: b0zbRHZEKMbGSdNoVSjI0gsxXTX2, time: 2021-03-04 06:06:48,}],
Error type 'String' is not a subtype of type 'DateTime'
Here i call to change my date & time to timeago with the help of this plugin..
ListView(
children: snapshot.data.map<Widget>((document) {
Provider.of<PostFunctions>(context, listen: false)
.showTimeAgo(document['time']);
return My Other Code...
)
I show like this in My Text
' , ${Provider.of<PostFunctions>(context, listen: false).getImageTimePosted.toString()}'
I Change my Date&Time Here
showTimeAgo(dynamic timedata) {
print(timedata);
imageTimePosted = timeago.format(timedata);
print(' my time posted ***** $imageTimePosted');
notifyListeners();
}