Last updated:
0 purchases
how old am i
how_old_am_i #
A Flutter package that helps to find Date Difference.
Installtion #
Add this to your package's pubspec.yaml file:
dependencies:
how_old_am_i: any
copied to clipboard
Example #
import 'package:how_old_am_i/how_old_am_i.dart';
void main() {
DateTime dateOfBirth = DateTime(1992, 7, 31);
DateTimeDuration dateTimeDuration;
// Find out your age as of today's date
dateTimeDuration = HowOldAmI.age(dateOfBirth);
print('Your age is ' + dateTimeDuration.toString());
//Find out your age on any given date
dateTimeDuration = HowOldAmI.age(dateOfBirth, today: DateTime(2030, 5, 1));
print('Your age is $dateTimeDuration');
// Find out when your next birthday will be
dateTimeDuration = HowOldAmI.timeToNextBirthday(dateOfBirth);
print('You next birthday will be in $dateTimeDuration');
// Find out when your next birthday will be on any given date
dateTimeDuration =
HowOldAmI.timeToNextBirthday(dateOfBirth, fromDate: DateTime(2022, 8, 2));
print('You next birthday will be in $dateTimeDuration');
// Find out the difference between two dates
dateTimeDuration = HowOldAmI.dateDifference(
fromDate: DateTime.now(),
toDate: DateTime(2025, 5, 2),
);
print('The difference is $dateTimeDuration');
// Add time to any date
DateTime date = HowOldAmI.add(
date: DateTime.now(),
duration: DateTimeDuration(years: 5, months: 2, days: 1));
print(date);
}
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.