listFiles method
-
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.
Implementation
Future<List<gd.File>> listFiles({
required String name,
String orderBy = lazy.defaultGDriveOrderBy,
String spaces = lazy.defaultGDriveSpace,
}) async {
String debugPrefix = '$runtimeType.listFiles()';
try {
// remote info
String q = "name: '$name'";
var gFileList = await list(
fields: lazy.defaultGDriveFields,
orderBy: orderBy,
spaces: spaces,
q: q,
);
lazy.log('$debugPrefix:${gFileList.jsonPretty()}');
List<gd.File>? gFiles = gFileList.files ?? [];
lazy.log('$debugPrefix:${gFiles.length}');
return gFiles;
} catch (e) {
throw ('$debugPrefix:catch:$e');
}
}