surfstudio / flutter-otp-autofill

Made by Surf 🏄
Apache License 2.0
81 stars 43 forks source link

How to implement SampleStrategy #47

Closed lala-naibova closed 1 year ago

lala-naibova commented 1 year ago

hi, how to implement SampleStrategy for reading sms ?

class SampleStrategy extends OTPStrategy {
  @override
  Future<String> listenForCode() {
    return Future.delayed(
      const Duration(seconds: 4),
      () => 'Your code is 54321',
    );
  }
}

How to return sms content except 'Your code is 54321' - this string ?

mark-kascheev commented 1 year ago

Hello @lala-naibova! You don't need a strategy to get a code from sms. Usually it's used for testing or to get code from push notification. Use final code = await otpInteractor.startListenUserConsent() for example