validated static method

TextPromptSync validated({
  1. required String title,
  2. required String? validator(
    1. String
    ),
  3. String? placeholder,
  4. PromptTheme theme = PromptTheme.dark,
})

Creates a text input with custom validation message.

final email = SyncPrompts.validated(
  title: 'Enter email',
  validator: (t) => t.contains('@') ? null : 'Invalid email',
).run();

Implementation

static TextPromptSync validated({
  required String title,
  required String? Function(String) validator,
  String? placeholder,
  PromptTheme theme = PromptTheme.dark,
}) {
  return TextPromptSync(
    title: title,
    theme: theme,
    placeholder: placeholder,
    validator: validator,
  );
}