check method

bool check(
  1. String otp, {
  2. int counter = 0,
  3. int breadth = 0,
})

Chack a OTP code.

@param otp The OTP code. @param counter The counter value. @param digits The OTP code length.

Implementation

bool check(
  String otp, {
  int counter = 0,
  int breadth = 0,
}) {
  for (int index = counter - breadth; index <= counter + breadth; index++) {
    if (otp ==
        make(
          digits: otp.length,
          counter: index,
        )) {
      return true;
    }
  }
  return false;
}