putStringMap static method

Future<bool> putStringMap(
  1. String? key,
  2. Map? value
)

存储sp中key的map值

Implementation

static Future<bool> putStringMap(String? key, Map? value) async {
  if (key == null || key.isEmpty || value == null) {
    return false;
  }
  String jsonMapString = jsonEncode(value);
  return await _preferences.setString(key, jsonMapString);
}