value method

String? value({
  1. DateTime? date,
})

Generate the OTP with a custom time.

All parameters are mandatory.

TOTP totp = TOTP(secret: 'BASE32ENCODEDSECRET');
totp.value(date: DateTime.now()); // => 432143

Implementation

String? value({DateTime? date}) {
  if (date == null) {
    return null;
  }

  int _formatTime = Util.timeFormat(time: date, interval: interval!);
  return super.generateOTP(input: _formatTime);
}