restoreState method

void restoreState()

Restore controller state with the latest SAVED version of fluttermoji and selectedOptions

Implementation

void restoreState() async {
  SharedPreferences pref = await SharedPreferences.getInstance();

  // Replace observable [fluttermoji] with latest saved version or use default attributes if null
  fluttermoji.value = pref.getString('fluttermoji') ??
      FluttermojiFunctions().decodeFluttermojifromString(
        jsonEncode(defaultFluttermojiOptions),
      );

  selectedOptions = await getFluttermojiOptions();
  update();
}