Read and Write Data

By default home_widget uses UserDefaults on iOS and SharedPreferences on Android to store data. In this section it is explained how to save and read data from the Flutter App as well as how to access data from your HomeScreen Widgets

Save Data

In order to save Data call

HomeWidget.saveWidgetData<String>('id', data);

Read Data

To retrieve the current Data saved in the Widget call

HomeWidget.getWidgetData<String>('id', defaultValue: data);

Check out the platform documentation of iOS and Android to see how to access this data in your widget.