readAsString static method

String readAsString(
  1. String path
)

Reads a file's content as a string.

Implementation

static String readAsString(String path) {
  try {
    final file = File(path);
    if (!file.existsSync()) {
      throw DeepLinkException('File not found: $path');
    }
    return file.readAsStringSync();
  } catch (e) {
    if (e is DeepLinkException) rethrow;
    throw DeepLinkException('Failed to read file $path', e);
  }
}