exportFile method

Future<String?> exportFile(
  1. String fileID,
  2. String mime
)

Export a Google Workspace file of fileID in the provided mime type

Implementation

Future<String?> exportFile(String fileID, String mime) async {
  final fileMedia = await driveAPI.files.export(
    fileID,
    mime,
    downloadOptions: DownloadOptions.fullMedia,
  );

  String fileData = "";
  await fileMedia!.stream.listen((bytes) {
    fileData += String.fromCharCodes(bytes);
  }).asFuture();
  return fileData;
}