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)

image

📄 Documentation

Go to flutter-server-driven-ui GitHub Wiki.

📄 License

flutter-server-driven-ui is BSD-3-Clause Licensed.