PatternSettings class
How df_config recognises a placeholder in a string.
A placeholder is bounded by opening and closing and contains a
default <delimiter> key body, where delimiter separates the
fallback text from the lookup key. separator joins the parts of a
dotted key (user.profile.name).
Case-folding applies to keys (never to the default value, which
is returned verbatim). When caseSensitive is false the lookup key
is passed through caseFold — by default String.toLowerCase. For
Turkish/Azerbaijani or other locales where the Unicode default
lowering produces the wrong result, supply a locale-aware folder.
caseFold is also a natural place to hang Unicode normalisation
(NFC) or bidirectional-control-character stripping for RTL scripts.
Direction-agnostic. All matching operates on UTF-16 code units, not on visual order. Arabic, Hebrew, Persian and Urdu content works out of the box; the only practical concern is making sure your keys are byte-for-byte stable (no stray bidi-control characters, no inconsistent precomposed-vs-combining diacritics).
Two canonical configurations are provided as constants:
tr() runs both passes by default: primary against translations,
secondary against ad-hoc args.
- Implementers
Constructors
Properties
- callback → String? Function(String key, dynamic suggestedReplacementValue, String defaultValue)?
-
User-supplied callback invoked for every successful pattern match.
Receives the parsed key, the value from the lookup map (or null if
not present), and the parsed default value. Return the desired
replacement, or
nullto fall back to the standardvalue ?? defaultchain.final - caseFold → String Function(String input)?
-
Optional custom case-folding function. Used in place of
String.toLowerCasewhen caseSensitive is false. Pass a locale-aware folder here for Turkish (İ↔i), Azerbaijani, or other special locales — and/or chain in Unicode normalisation (NFC) and bidi-control stripping for RTL languages.final - caseSensitive → bool
-
final
- closing → String
-
final
- delimiter → String
-
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- opening → String
-
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- separator → String
-
final
Methods
-
foldKey(
String input) → String -
Applies the active case-folding strategy to
input. -
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
Constants
- primary → const PatternSettings
-
The primary placeholder syntax:
{{ default || key }}. - secondary → const PatternSettings
-
The secondary placeholder syntax:
{ default | key }. Used bytr()for the second pass so args can be interpolated with single braces without colliding with translation keys.