ui_schema library

A tiny JSON vocabulary for describing a Flutter screen, and a renderer for it — a proof of concept for having a language model build an interface.

Import this only if you want it: it is deliberately a separate library from package:chatgpt_free/chatgpt_free.dart, so a consumer who just wants the chat client never sees any of it.

Classes

JsonUiView
Renders a UiSpec as real Flutter widgets, and runs its actions.
UiAction
Something a button does to the state.
UiNode
One node of the tree.
UiSpec
A screen described as JSON, and the state it operates on.

Constants

kUiSchemaInstructions → const String
The instruction that turns a chat turn into an interface generator.

Functions

evaluateExpression(String input) double
Evaluates the small arithmetic language the calc action uses.
formatNumber(double value) String
Formats a computed value the way a calculator display would: 4, not 4.0.
resolveBindings(String template, Map<String, String> state) String
Substitutes {{key}} bindings from state.