Converting DateTime to time ago in Dart/Flutter

You can also try this package, Jiffy.

You can get relative time from now

// This returns time ago from now
Jiffy().fromNow(); // a few seconds ago

//You can also pass in a DateTime Object or a string or a list
Jiffy(DateTime.now()).fromNow; // a few seconds ago
//or
Jiffy(DateTime(2018, 10, 25)).fromNow(); // a year ago
Jiffy("2020-10-25").fromNow(); // in a year

Manipulating is also simple in Jiffy

var dateTime = Jiffy().add(hours: 3, months: 2);

dateTime.fromNow(); // in 2 months

You can also get relative time from a specified time apart from now

Jiffy([2022, 10, 25]).from([2022, 1, 25]); // in 10 months

I used timeago for the exact purpose and found it quite useful. It has multiple format and different languages support as well.