Flutter Server Driven UI
🚀 Server Driven UI Package for Flutter. New features to be deployed on all platforms simultaneously via a backend change, without releasing new versions of the native apps.
🚀 Quick Start
Download the package:
flutter pub add server_driven_ui
Get JSON & Parsing json to widget:
void main() {
String json = """
{
"widgetName": "Scaffold"
}
""";
runApp(MyApp(json: json));
}
class MyApp extends StatelessWidget {
late String json;
MyApp({required this.json});
@override
Widget build(BuildContext context) {
return MaterialApp(
home: RouteWidget(
provider: StaticContentProvider(content: json),
),
);
}
}
Also can create and use custom widget:
class CustomWidget extends BaseWidget {
@override
Widget build(BuildContext context) {
return Text("Hello, World!");
}
}
void main() {
// Argument = WidgetName, WidgetFactory
WidgetRegistry.register('CustomWidget', () => CustomWidget()); // Registering your custom widget into server-driven-ui widget factory storage.
String json = """
{
"widgetName": "Scaffold"
"child": {
"widgetName": "CustomWidget"
}
}
""";
runApp(MyApp(json: json));
}
🖼️ Architecture (Core logic)
📄 Documentation
Go to flutter-server-driven-ui GitHub Wiki.
📄 License
flutter-server-driven-ui is BSD-3-Clause Licensed.
Libraries
- adapter/http.adapter
- core/action
- core/base_widget
- core/content_provider
- core/json_parser
- core/page_transition
- core/page_transition_registry
- core/route_widget
- core/widget_registry
- main
- server_driven_ui
- type/json.type
- type/widget_factory.type
- widget/blank.widget
- widget/dynamic.widget
- widget/text.widget