createFile method
Create a new file with fileName
, and a mime
type
that is from FileMIMETypes or a custom string
Optionally, specify the ID(s) of the parents
folder(s).
You can provide some text to initialise the file with (e.g. header data or boilerplate)
Returns the ID of the file created, store this to refer to this file in the future.
Implementation
Future<String> createFile(
String fileName,
String mime, {
List<String>? parents,
String text = "",
}) async {
return (await driveAPI.files.create(
File(
name: fileName,
mimeType: mime,
parents: parents,
),
uploadMedia: Media(
Stream.value(ascii.encode(text)),
text.length,
),
))
.id!;
}