appTotalDaysSinceFirstLaunch static method

Future<int> appTotalDaysSinceFirstLaunch()

Days since first launch

Implementation

static Future<int> appTotalDaysSinceFirstLaunch() async {
  return await useMonitoringMethod(() async {
    String? firstLaunch = await readValue("first_launch");
    if (firstLaunch == null || firstLaunch.isEmpty) {
      return 0;
    }

    DateTime firstLaunchDateTime = DateTime.parse(firstLaunch);
    DateTime todayDateTime = DateTime.now();
    Duration difference = todayDateTime.difference(firstLaunchDateTime);
    return difference.inDays;
  });
}