小编Ant*_*oun的帖子

如何在 flutter 应用程序中使用 google Drive api 创建文件夹?

我尝试在flutter appa 中创建文件夹google drive account。它向我展示了一个bad argument(s) error. 虽然我正在使用文档示例

这是我尝试做的代码。它产生

“错误的参数”错误。

final _SCOPES = [drive.DriveApi.DriveScope];

  void adrive(){

clientViaServiceAccount(_credentials,_SCOPES).then(onValue).catchError((e)=>print(e));
  }


  FutureOr onValue(AuthClient client)  {
    //drive.DriveApi(client).files.list().then((value)=>print(value.items[0]));
    // The previous line works fine
    drive.File r = new drive.File();
    r.mimeType = "application/vnd.google-apps.folder";
    r.title = "hello";

    drive.DriveApi(client).files.insert(r,uploadOptions: commons.UploadOptions.Resumable).then((f)=>print(f.mimeType+" "+f.originalFilename))
          .catchError((ex)=>print(ex.toString()));




Run Code Online (Sandbox Code Playgroud)

google-api drive dart google-drive-api flutter

5
推荐指数
1
解决办法
2415
查看次数

标签 统计

dart ×1

drive ×1

flutter ×1

google-api ×1

google-drive-api ×1