Ask class
Class for ask and related code.
Constructors
- Ask()
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
all(
List< AskValidator> validators) → AskValidator - Takes an array of validators. The input is considered valid only if everyone of the validators pass.
-
any(
List< AskValidator> validators) → AskValidator - Takes an array of validators. The input is considered valid if any one of the validators returns true. The validators are processed in order from left to right. If none of the validators pass then the error from the first validator that failed is returned. The implications is that the user will only ever see the error from the first validator.
-
defaultPrompt(
String prompt, String? defaultValue, ) → String -
inList(
List< Object> validItems, {bool caseSensitive = false}) → AskValidator -
Checks that the input matches one of the
provided
validItems
. If the validator fails it prints out the list of available inputs. By defaultcaseSensitive
matches are off. -
ipAddress(
{int version = AskValidatorIPAddress.either}) → AskValidator -
Validates that input is a IP address
By default both v4 and v6 addresses are valid
Pass a
version
to limit the input to one or the other. If passedversion
must be AskValidatorIPAddress.ipv4 or AskValidatorIPAddress.ipv6. -
lengthMax(
int maxLength) → AskValidator -
Validates that the entered line is no longer
than
maxLength
. -
lengthMin(
int minLength) → AskValidator -
Validates that the entered line is not less
than
minLength
. -
lengthRange(
int minLength, int maxLength) → AskValidator -
Validates that the length of the entered text
as at least
minLength
but no more thanmaxLength
. -
regExp(
String regExp, {String? error}) → AskValidator - Validates the input against a regular expression
-
valueRange(
num minValue, num maxValue) → AskValidator - Validates that a number is between a minimum value (inclusive) and a maximum value (inclusive).
Constants
- alpha → const AskValidator
- validates that the input is only alpha characters
- alphaNumeric → const AskValidator
- validates that the input is only alphanumeric characters.
- date → const AskValidator
- validates that the input is a date.
- decimal → const AskValidator
- validates that the input is a decimal
- dontCare → const AskValidator
- The default validator that considers any input as valid
- email → const AskValidator
- validates that the input is an email address
- fqdn → const AskValidator
- validates that the input is a fully qualified domian name.
- integer → const AskValidator
- validates that the input is an integer
- required → const AskValidator
- The user must enter a non-empty string. Whitespace will be trimmed before the string is tested.