otpCountdownUi method
A simplified reactive StreamBuilder UI helper for the OTP resend countdown.
The builder receives only the remaining seconds as an int.
Implementation
Widget otpCountdownUi({required Widget Function(int seconds) builder}) {
return StreamBuilder<int>(
stream: otpManager.resendCountdown.stream,
initialData: otpManager.resendCountdown.value,
builder: (context, snapshot) {
if (snapshot.hasError) {
return const SizedBox.shrink();
}
return builder(snapshot.data ?? 0);
},
);
}