core/extensions library

Extensions

MessageExtension on Message

Functions

functionGemmaArgument(dynamic value, {bool escapeKeys = true}) String
The template's format_argument macro: strings are escape-wrapped, booleans and numbers stay bare, lists and maps recurse.
functionGemmaDictsort(Iterable<String> keys) List<String>
Jinja's dictsort, which defaults to case_sensitive=False. A plain .sort() would put Beta before alpha; the template does the reverse.
functionGemmaDouble(double value) String
Python's str(float). The template is Jinja, so every number in the prompt was formatted by Python. Both languages print the shortest round-trip digits, but they switch to exponent notation at different magnitudes: Python below 1e-4 and from 1e16, Dart below 1e-6 and from 1e21.
functionGemmaFold(String key) String
Python's str.lower(), which Jinja's dictsort folds keys with. Dart maps İ (U+0130) to a plain i; Python appends a combining dot, which sorts after it.
functionGemmaResponseBody(Object? response) String
The body of response:NAME{...}.
functionGemmaScalar(dynamic value) String
Jinja renders a bare {{ value }} through Python's str(), so booleans capitalise, null becomes None, and floats follow Python's notation.