A New Flutter project.
This project adds a homescreen widget to Flutter app using the native code and method channels.
You can clone the repo from here.
Download APK.
I have coded the whole widget in kotlin and used sharedprefs for sharing data between app and the widget.
I used Method channels for communicate with the native kotlin code in the app.
The app comes with a simple widget which will show the count of no. of times the button is pressed.
And also when pressed on the widget will open the app even if it is not running in the background.
You can change the appereance of the widget by changing the xml file present at HomeScreen_widget_Flutter/android/app/src/main/res/layout/app_widget.xml
And the size of the widget can altered at HomeScreen_widget_Flutter/android/app/src/main/res/xml/app_widget_info.xml