readFileDataAsText function

Future<String?> readFileDataAsText(
  1. File file
)

Reads file as text.

Implementation

Future<String?> readFileDataAsText(File file) async {
  final reader = FileReader();
  reader.readAsText(file);
  await Future.any(
      [reader.onLoad.first, reader.onError.first, reader.onAbort.first]);
  var fileData = reader.result as String?;
  return fileData;
}