read method

Future<FileData> read(
  1. FileDataType type
)

Implementation

Future<FileData> read(FileDataType type) async {
  if (type == FileDataType.text) {
    final content = await readAsString();
    return StringFileData(content, name);
  } else if (type == FileDataType.binary) {
    final bytes = await readAsBytes();
    return BinaryFileData(bytes, name);
  }
  throw UnimplementedError('Read not supported for file type $type.');
}