readFileSafe function

String readFileSafe(
  1. String path
)

Reads file content, returns empty string on failure.

Implementation

String readFileSafe(String path) {
  try {
    return File(path).readAsStringSync();
  } catch (_) {
    return '';
  }
}