I am curious about how major top social media apps updating their UI without user interaction. I want to implement same in flutter mobile app. I have gone through dynamic feature (On-Demand feature in android)
But, Don’t know do play store allow to upload only specific component.
If anyone have please help me.
2
Answers
What you are looking for, are remote widgets and Server-Driven UI.
Using Server-Driven UI and Remote Widgets in Flutter
What is Server-Driven UI?
Server-Driven UI is an approach where a server determines the structure and appearance of the user interface, dynamically sending instructions to the client at runtime on how to render it. This can be particularly useful in Flutter applications to achieve a more flexible and scalable UI.
Implementing Server-Driven UI in Flutter
To implement Server-Driven UI in Flutter, you can use the official rfw (Remote Flutter Widgets) package by
flutter.dev
.Firstly, create a
.rfwtxt
file with your remote widget that has the following structure:Then, run
encoder.dart
in the directory of your.rfwtxt
file to encode it into a .rfw
file, which can than be used by the package (you need to adapt the file names accordingly).Next, prepare your runtime and download the previously created file within your code:
Limitations
RFW is ideal for creating dynamic custom UIs with prebuilt components. However, it falls short in handling complex UI elements like gestures, animations, and custom painters. For fundamental UI changes, navigation adjustments, or new features, it’s recommended to utilize Flutter itself. RFW is best suited for adapting to unforeseen UI requirements within an evolving application.
Conclusion
This will fetch your
.rfw
file from your server at runtime, load it into your app and render it, allowing your application to dynamically adapt to server-side changes in the user interface. You could also implement code that periodically fetches the file from your database or listens for changes, so your UI stays up-to-date.For more information, refer to the docs.
You can try shorebird to push app updates directly to users’ devices