setWD method

Future<bool> setWD(
  1. String folder
)

Implementation

Future<bool> setWD(String folder) async {
  if(!await ready()) return false;
  try{
    if(folder == "" || folder == "/"){
      wd = scope == DriveApi.driveAppdataScope ? "appDataFolder" : "root";
      return true;
    }
    var foldId = await getIDFromRoot(folder, mimeType: DriveQueryBuilder.folderMime, createIfMissing: true);
    if (foldId == null) return false;
    wd = foldId;
    return true;
  }catch(e, stack){
    if(e is PlatformException && e.code == "network_error"){
      return false;
    }
    if(kDebugMode){
      print("setWD:");
      print("${e.toString()}\n${stack.toString()}");
    }else if (onError != null){
      onError!(e, stack);
    }
    return false;
  }
}