InterpolationOption class
The option for the Interpolation to find placeholder inside String & Json objects and interpolate (replace) them with provided values.
The default options are:
{
prefix = '{',
suffix = '}',
subKeyPointer = '.',
}
Hence, a string with placeholder would look like
var str = "Hi, my name is '{name}'. I'm {age}. I am {education.degree} {education.profession}.";
and, the appropriate value collection for it may be
var value = {
'name': 'David',
'age': 29,
'education': {
'degree': 'M.B.B.S',
'profession': 'Doctor'
}
}
Similarly a json equivalent dart object may be
var obj = {
'a': 'a',
'b': 10,
'c': {
'd': 'd',
'e': 'Hello {c.d}',
'f': 'Hi "{a}", am I deep enough, or need to show "{c.e}" with {b}'
}
};
which contains its own placeholder value in itself.
Constructors
- InterpolationOption({String prefix = '{', String suffix = '}', String subKeyPointer = '.'})
-
Create an InterpolationOption instance with the default values (if not specified)
factory
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- prefix → String
-
the trimmed and Regex escaped form of prefix
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- subKeyPointer → String
-
the trimmed and Regex escaped form of subKeyPointer
no setter
- suffix → String
-
the trimmed and Regex escaped form of suffix
no setter
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