Message class abstract

An abstract superclass for Intl.message/plural/gender calls in the program's source text. We assemble these into objects that can be used to write out some translation format and can also print themselves into code.

Implementers

Constructors

Message(Message? parent)

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 setter
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 setter
hashCode int
The hash code for this object.
no setterinherited
name String
The name of the top-level MainMessage.
no setter
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 pair
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

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.
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.
escapeAndValidateString(String value) String
Escape the string for use in generated Dart code.
expanded([Function f]) 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.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toCode() String
Return a string representation of this message for use in generated Dart code.
toJson() Object
Return a JSON-storable representation of this message which can be interpolated at runtime.
toString() String
A string representation of this object.
inherited
validate() → void
Verify that a constructed message is valid.

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

classPlusMethodName(MethodInvocation node, String? outerName) String?
Return the name of the enclosing class (if any) plus method name, or null if there's no enclosing class.
from(Object value, Message? parent) Message
Turn a value, typically read from a translation file or created out of an AST for a source program, into the appropriate subclass. We expect to get literal Strings, variable substitutions represented by integers, things that are already MessageChunks and lists of the same.