Dynamic UI Engine for Flutter
A JSON-driven dynamic UI engine for Flutter that enables server-driven UI, navigation, and API workflows at runtime.
Features
- Render Flutter widgets from JSON
- Server-driven UI
- Navigation & routing support
- Sequential & parallel API calls
- State-management agnostic core
- Optional adapters (GetX, Bloc, Riverpod)
Installation
dependencies:
dynamic_ui_engine: ^1.0.0
Basic Usage
import 'package:dynamic_ui_engine/dynamic_ui_engine.dart';
// Build UI from JSON. Provide your own ActionHandler for navigation and API.
final widget = DynamicWidgetBuilder.build(
jsonConfig,
actionHandler: MyActionHandler(),
bindingContext: {'user': {'name': 'Alice'}},
);
JSON Example
Simple column with text and button:
{
"type": "column",
"children": [
{ "type": "text", "data": { "value": "Hello" } },
{ "type": "button", "data": { "label": "Next" } }
]
}
With schema version and ui wrapper:
{
"schemaVersion": "1.0",
"ui": {
"type": "column",
"children": [
{ "type": "text", "data": { "value": "Welcome {{user.name}}" } },
{
"type": "button",
"data": {
"label": "Submit",
"onClick": {
"type": "action_group",
"execution": "sequential",
"actions": [
{ "type": "api_call", "method": "POST", "url": "/login", "bindTo": "user" },
{ "type": "navigate", "route": "/home" }
]
}
}
}
]
}
}
State Management
The core package is state-management agnostic. Implement ActionHandler for navigation and API calls. Optional adapter packages:
dynamic_ui_getxdynamic_ui_blocdynamic_ui_riverpod
Error Handling
- Unknown widget types: Rendered as a placeholder ("Unknown widget: type") so existing JSON does not break when new types are added.
- JSON validation: The parser fails fast with a clear JsonParserException when required fields (e.g.
type) are missing or invalid. - API failures: The engine only invokes ActionHandler.handle. Retry, stop, or ignore behaviour is the responsibility of your handler.
Security
- No dynamic code execution: JSON config never executes code; only declared action types (navigate, api_call, action_group) are run.
- API allow-listing: Your ActionHandler should allow-list base URLs and validate payload size before performing API calls.
- Payload size: Consider validating JSON size before parsing to avoid excessive memory use.
Versioning
- Payloads may include
schemaVersion(e.g."1.0"). Unsupported versions throw at parse time. - Backward compatibility is guaranteed within the same major version of the package.
Roadmap
- Forms (TextField, Dropdown)
- Conditional UI
- Animations
License
MIT
Libraries
- core/actions/action_engine
- core/bindings/binding_engine
- core/engine
- core/parser/json_parser
- core/registry/widget_registry
- dynamic_ui_engine
- Dynamic UI Engine for Flutter – JSON-driven UI at runtime.
- interfaces/action_handler
- interfaces/state_adapter
- widgets/column_widget
- widgets/row_widget
- widgets/text_widget
- widgets/unknown_widget