readPreferences static method

Future<Map<String, Object?>> readPreferences(
  1. SharedPreferencesPlusOptions options
)

Implementation

static Future<Map<String, Object?>> readPreferences(SharedPreferencesPlusOptions options) async {
  final file = await _getDbFile(options);
  if (file == null || !file.existsSync()) {
    return {};
  }
  final contents = await file.readAsString();
  if (contents.isEmpty) {
    return {};
  }
  return jsonDecode(contents) as Map<String, Object?>;
}