getLatest method
-
name
is filename -
spaces
Google Drive Space. default to 'appDataFolder' -
Return meta of latest version of remote file with
name
inspaces
-
Return null if file not found.
Implementation
Future<gd.File?> getLatest({
required String name,
String spaces = lazy.defaultGDriveSpace,
}) async {
// Future<gd.File> searchLatest(String name) async {
var debugPrefix = '$runtimeType.getLatest()';
// Get FileList containing name
try {
List<gd.File> gFiles = await listFiles(
name: name,
spaces: spaces,
);
gd.File? gFile;
if (gFiles.isNotEmpty) {
gFile = gFiles.last;
lazy.log('$debugPrefix:gFiles.last:\n${gFile.jsonPretty()}');
}
return gFile;
} catch (e) {
throw ('$debugPrefix:$e');
}
}