Select class

Represents a message send of Intl.select inside a message that is to be internationalized. This corresponds to an ICU message syntax "select" with arbitrary options.

Inheritance

Constructors

Select()
Select.from(String mainArgument, List clauses, Message? parent)
Create a new Select providing mainArgument and the list of possible clauses. Each clause is expected to be a list whose first element is a variable name and whose second element is either a String or a list of strings and Messages or VariableSubstitutions.

Properties

arguments → dynamic
We find the arguments from the top-level MainMessage and use those to do variable substitutions. MainMessage overrides this to return the actual arguments.
no setterinherited
attributeNames List<String>
no setteroverride
cases Map<String, Message>
getter/setter pair
codeAttributeNames List<String>
Return the list of attribute names to use when generating code. This may be different from attributeNames if there are multiple aliases that map to the same clause.
no setteroverride
dartMessageName String
Return the message name we would use for this when doing Dart code generation, e.g. "Intl.plural".
no setteroverride
examples → dynamic
We find the examples from the top-level MainMessage and use those when writing out variables. MainMessage overrides this to return the actual examples.
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
icuMessageName String
Return the name of the message type, as it will be generated into an ICU-type format. e.g. choice, select
no setteroverride
mainArgument String?
The name of the main argument, which is expected to have the value which is one of attributeNames and is used to decide which clause to use.
getter/setter pairinherited
name String
The name of the top-level MainMessage.
no setterinherited
parent Message?
All Messages except a MainMessage are contained inside some parent, terminating at an Intl.message call which supplies the arguments we use for variable substitutions.
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

argumentsOfInterestFor(MethodInvocation node) Map
Return the arguments that we care about for the select. In this case they will all be passed in as a Map rather than as the named arguments used in Plural/Gender.
override
checkArgs(NamedExpression? args, List<String> parameterNames) bool
Verify that the args argument matches the method parameters and isn't, e.g. passing string names instead of the argument values.
inherited
checkValidity(MethodInvocation node, List arguments, String? outerName, FormalParameterList outerArgs, {bool nameAndArgsGenerated = false, bool examplesRequired = false}) String?
Verify that this looks like a correct Intl.message/plural/gender/... invocation.
inherited
escapeAndValidateString(String value) String
Escape the string for use in generated Dart code.
inherited
expanded([Function transform = _nullTransform]) String
Expand this string out into a printed form. The function f will be applied to any sub-messages, allowing this to be used to generate a form suitable for a wide variety of translation file formats.
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toCode() String
Write out the generated representation of this message. This differs from Plural/Gender in that it prints a literal map rather than named arguments.
override
toJson() Object
We represent this in JSON as a List with the name of the message (e.g. Intl.select), the index in the arguments list of the main argument, and then a Map from the cases to the List of strings or sub-messages.
override
toString() String
A string representation of this object.
inherited
validate() → void
Verify that a constructed message is valid.
override

Operators

operator ==(Object other) bool
The equality operator.
inherited
operator [](String attributeName) Message?
When we create these from strings or from AST nodes, we want to look up and set their attributes by string names, so we override the indexing operators so that they behave like maps with respect to those attribute names.
override
operator []=(String attributeName, dynamic rawValue) → void
When we create these from strings or from AST nodes, we want to look up and set their attributes by string names, so we override the indexing operators so that they behave like maps with respect to those attribute names.
override

Static Properties

validSelectKey RegExp
final

Constants

selectPattern → const String