readAsString_ method

FutureOr<String?> readAsString_()

Reads the contents of the File as String. Returns null if the File does not exist.

Implementation

FutureOr<String?> readAsString_() {
  _locks[addPrefix(path)] ??= Lock();
  return _locks[addPrefix(path)]?.synchronized(() async {
    final file = File(addPrefix(path));
    if (await file.exists_()) {
      return await file.readAsString();
    }
    return null;
  });
}