readFile static method

String readFile(
  1. String path
)

Reads and returns the content of the file at path.

Returns an empty string if the file doesn't exist.

Implementation

static String readFile(String path) {
  final file = File(path);
  if (!file.existsSync()) return '';
  return file.readAsStringSync();
}