cloud_sync_drive 0.1.1 copy "cloud_sync_drive: ^0.1.1" to clipboard
cloud_sync_drive: ^0.1.1 copied to clipboard

Google Drive adapter for the cloud_sync family. Supports drive, drive.file, and drive.appdata scopes. Implements StorageAdapter so it plugs directly into SyncClient.

cloud_sync_drive #

Google Drive adapter for the cloud_sync family. Implements StorageAdapter from cloud_sync_core, so it plugs directly into SyncClient or SyncEngine.

Install #

dependencies:
  cloud_sync_core: ^0.1.0
  cloud_sync_drive: ^0.1.0
  google_sign_in: ^6.0.0   # or any OAuth2 client that yields an authenticated http.Client

Quick start #

import 'package:cloud_sync_core/cloud_sync_core.dart';
import 'package:cloud_sync_drive/cloud_sync_drive.dart';
import 'package:google_sign_in/google_sign_in.dart';

final signIn = GoogleSignIn(scopes: ['https://www.googleapis.com/auth/drive.file']);
final account = await signIn.signIn();
final authClient = DriveAuthClient(await account!.authHeaders);

final adapter = DriveAdapter.appFiles(
  httpClient: authClient,
  folderName: 'MyApp',
  subPath: 'Backups',
);

final client = SyncClient(adapter: adapter);
final result = await client.sync(localPath: '/path/to/data');

Scope modes #

Factory OAuth scope Use when
DriveAdapter.userDrive(basePath:) drive Files are written by multiple clients (mobile + CLI + Drive Desktop)
DriveAdapter.appFiles(folderName:) drive.file Single-writer app sync. No CASA required.
DriveAdapter.appData(subPath:) drive.appdata Internal app state. Hidden from user. No CASA required.

See DriveScope doc comments for the full tradeoff discussion including CASA audit cost and scope compliance.

License #

MIT

0
likes
160
points
141
downloads

Documentation

API reference

Publisher

unverified uploader

Weekly Downloads

Google Drive adapter for the cloud_sync family. Supports drive, drive.file, and drive.appdata scopes. Implements StorageAdapter so it plugs directly into SyncClient.

Repository (GitHub)
View/report issues
Contributing

Topics

#google-drive #sync #backup

License

MIT (license)

Dependencies

cloud_sync_core, googleapis, http

More

Packages that depend on cloud_sync_drive