Menu

1 / 5

form_expressions: a safe expression language for dynamic forms in Dart

DEV Community: dart·Abdeldjalil Chougui·about 13 hours ago
#GhhckaNc
#devtodart#devto#dev#engine#compile
Reading 0:00
15s threshold

A dynamic form is a form whose definition is data: a survey builder, an order form configured in an admin panel, a checklist downloaded from a server. Sooner or later, that definition needs logic. A total that is computed from other fields. A question that appears only when the previous answer is "yes". A rule that says the age must be at least 18. A sentence that greets the user by name.

That logic has to be stored as text, next to the form, and written by whoever configures the form. So you need a small language. Two shortcuts are tempting, and both end badly: a {{field}} string replacer that grows one special case at a time, or evaluating real code that comes from outside the app.

form_expressions is a small expression language made for this job. It is pure Dart, it is sandboxed, and it never evaluates Dart code. It covers calculated fields, show/hide conditions, validation rules and {{field}} text piping.

What it does

A proper pipeline.…

Continue reading — create a free account

Join HashtagPLUS to read full articles, follow hashtags, vote, and join the conversation.