setFromMap method

Future<bool> setFromMap(
  1. Map<String, dynamic> map
)

Implementation

Future<bool> setFromMap(Map<String, dynamic> map) async {
  final futures = <Future<bool>>[];
  for (var key in map.keys) {
    futures.add(prefrences.setString(key, jsonEncode(map[key])));
  }
  var results = await Future.wait(futures);
  for (var r in results) {
    if (!r) return false;
  }
  return true;
}