installDate property

Future<DateTime> get installDate

Returns the install date of the application

In case when platform is Android the installation date given by the platform is used

In case when platform is iOS the application document directory creation date is used. This method is used in native iOS development to determine the install date of the application https://stackoverflow.com/questions/4090512/how-to-determine-the-date-an-app-is-installed-or-used-for-the-first-time

Implementation

Future<DateTime> get installDate async {
  if (PlatformUtils.isAndroid) {
    final installDateInMilliseconds =
        await _channel.invokeMethod<int>('getInstallDate');
    if (installDateInMilliseconds != null) {
      return DateTime.fromMillisecondsSinceEpoch(installDateInMilliseconds);
    } else {
      throw FailedToGetInstallDateException(
          'Install time from platform is null');
    }
  } else {
    return _getInstallDate();
  }
}