Closed nattawutxp closed 10 months ago
You can use forceErrorState
property:
class ErrorStateExample extends StatefulWidget {
const ErrorStateExample({Key? key}) : super(key: key);
@override
State<ErrorStateExample> createState() => _ErrorStateExampleState();
}
class _ErrorStateExampleState extends State<ErrorStateExample> {
bool _hasError = false;
Future<void> _validate(String value) async {
await Future.delayed(const Duration(seconds: 2));
setState(() => _hasError = value == '1111');
}
@override
Widget build(BuildContext context) {
return Pinput(
forceErrorState: _hasError,
onCompleted: _validate,
);
}
}
Closing the issue for now because of inactivity, feel free to reopen if needed.
I want pinput to be able to use async in the validator step.