GDrive class

token is empty during instantiate. However it must be set before calling any calling any method.

Constructors

GDrive()

Properties

debugLogList bool
Print file list in log
getter/setter pair
hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
token String
Google OAuth2 token
getter/setter pair

Methods

create({required File file, required Media uploadMedia}) Future<File>
DriveApi.files.create wrapper that create file with media(file content)
del(String fileId) Future
DriveApi.files.del wrapper
delCopies({required String name, String spaces = lazy.defaultGDriveSpace, int keepNumberOfLatest = 5}) Future
Delete old copies of file with name in spaces and keep number of latest copy.
download(File gFile) Future<String>
Return content of gFile in String
get(String fileId, {DownloadOptions downloadOptions = lazy.defaultGDriveDownloadOptions}) Future<Object>
DriveApi.files.get wrapper
getLatest({required String name, String spaces = lazy.defaultGDriveSpace}) Future<File?>
  • name is filename

  • spaces Google Drive Space. default to 'appDataFolder'

  • Return meta of latest version of remote file with name in spaces

  • Return null if file not found.

  • list({String fields = lazy.defaultGDriveFields, String orderBy = lazy.defaultGDriveOrderBy, String spaces = lazy.defaultGDriveSpace, String? q}) Future<FileList>
    DriveApi.files.list wrapper
    listFiles({required String name, String orderBy = lazy.defaultGDriveOrderBy, String spaces = lazy.defaultGDriveSpace}) Future<List<File>>
  • name is filename

  • orderBy result sort order, default sort by modified time

  • spaces Google Drive Space. default to 'appDataFolder'

  • Return remote file meta list

  • Return empty list if file not found.

  • noSuchMethod(Invocation invocation) → dynamic
    Invoked when a nonexistent method or property is accessed.
    inherited
    toString() String
    A string representation of this object.
    inherited
    update({required File file, required Media uploadMedia}) Future<File>
    DriveApi.files.update wrapper that only update media(file content)
    updateContent({required File file, required String content}) Future
    DriveApi.files.update wrapper that take String content and update file media(file content)
    upload({required String name, required String content, DateTime? modifiedTime, List<String> parents = lazy.defaultGDriveParents}) Future
    Create remote file name with content

    Operators

    operator ==(Object other) bool
    The equality operator.
    inherited