setMap static method
Implementation
static Future setMap( String key, Map<String, dynamic> mapJson ,{ VoidCallback? callback} ) async {
// Map<String, Object> values = <String, Object>{'counter': 1};
//convert to json
String json = jsonEncode(mapJson);
// Log.k( tag, "setObject() mapJson: " + mapJson.toString() );
// Log.k( tag, "setObject() json: " + json );
//set json to cache
SharedPreferences prefs = await SharedPreferences.getInstance();
await prefs.setString(key, json);
//callback
if(callback != null ) callback();
}