encodeMySVGtoString method

Future<String> encodeMySVGtoString()

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

returns a Future, you have to await on function call

Implementation

Future<String> encodeMySVGtoString() 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 jsonEncode(_fluttermojiOptionsMap);
  }
  return _fluttermojiOptions;
}