initState method

  1. @override
void initState()
override

Initializes the OTP input fields with the specified length before the widget builds for the first time. Calls super.initState() after initialization to complete setup.

Implementation

@override
void initState() {
  _initializeOtpFields(widget.length);

  // Start listening for OTP code if autofill is enabled
  _listenForOtpCode();

  // Get app signature for SMS autofill (Android)
  SmsAutoFill().getAppSignature.then((signature) {
    if (widget.enableAutoFill) log('signature: $signature');
  });

  super.initState();
}