Skip to content

[General]: Support AutoValidateMode.onUserInteraction with debouncing  #1316

@Rydeard

Description

@Rydeard

Is there an existing issue for this?

  • I have searched the existing issues

Package/Plugin version

9.1.1

What you'd like to happen

Currently, AutovalidateMode.onUserInteraction is immediate. It'd be great if we could delay it by debouncing, so that when the user stops typing for some amount of seconds, that's when the field is validated.

And specifically, it'd be great to be able to debounce validation per field, instead of validating the whole form at once.

Alternatives you've considered

This discussion is the big inspiration for this feature request: https://stackoverflow.com/questions/71441597/how-to-achieve-the-best-ux-with-flutter-form-autovalidatemode

You can see that the Lalit's answer provides an implementation for debouncing. This works great if you're content to validate the entire form at once, but for my purposes I'd like to validate just the field that is being interacted with. There is already the per field AutovalidateMode.onUserInteraction that almost achieves what I want.

Aditional information

Many options for implementation come to mind. Here's one:

Implement a new autoValidateMode: `debounced`/`onUserInteractionDelayed`, with some fixed debounce timing (e.g 2 seconds). An additional property to override the Duration would be nice to have, too.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions