encodeMySVGtoMap method

Future<Map<String, dynamic>> encodeMySVGtoMap()

Retrieve the local user's fluttermoji attributes from local storage and encode them to a Map of attributes

returns a Future, you have to await on function call

Implementation

Future<Map<String, dynamic>> encodeMySVGtoMap() async {
  SharedPreferences pref = await SharedPreferences.getInstance();
  String? _fluttermojiOptions = pref.getString('fluttermojiSelectedOptions');
  if (_fluttermojiOptions == null || _fluttermojiOptions == '') {
    Map<String, int> _fluttermojiOptionsMap =
        Map.from(defaultFluttermojiOptions);
    await pref.setString(
        'fluttermojiSelectedOptions', jsonEncode(_fluttermojiOptionsMap));

    return _fluttermojiOptionsMap;
  }

  return Map.from(jsonDecode(_fluttermojiOptions));
}